
KeylessUniversal

-- LocalScript inside StarterPlayerScripts
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")
local UserInputService = game:GetService("UserInputService")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
-- Create ScreenGui
local ScreenGui = Instance.new("ScreenGui")
ScreenGui.Name = "TeamCreatorGui"
ScreenGui.Parent = PlayerGui
-- Create Frame
local Frame = Instance.new("Frame")
Frame.Size = UDim2.new(0, 300, 0, 180)
Frame.Position = UDim2.new(0.5, -150, 0.5, -90)
Frame.BackgroundColor3 = Color3.fromRGB(50, 50, 50)
Frame.BorderSizePixel = 0
Frame.Parent = ScreenGui
-- Title (for dragging)
local Title = Instance.new("TextLabel")
Title.Size = UDim2.new(1, 0, 0, 30)
Title.Position = UDim2.new(0, 0, 0, 0)
Title.BackgroundColor3 = Color3.fromRGB(30, 30, 30)
Title.Text = "Team Creator"
Title.TextColor3 = Color3.fromRGB(255, 255, 255)
Title.Font = Enum.Font.SourceSansBold
Title.TextSize = 20
Title.Parent = Frame
-- Make GUI draggable
local dragging = false
local dragInput, mousePos, framePos
Title.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseButton1 then
dragging = true
mousePos = input.Position
framePos = Frame.Position
input.Changed:Connect(function()
if input.UserInputState == Enum.UserInputState.End then
dragging = false
end
end)
end
end)
Title.InputChanged:Connect(function(input)
if input.UserInputType == Enum.UserInputType.MouseMovement then
dragInput = input
end
end)
UserInputService.InputChanged:Connect(function(input)
if input == dragInput and dragging then
local delta = input.Position - mousePos
Frame.Position = UDim2.new(framePos.X.Scale, framePos.X.Offset + delta.X, framePos.Y.Scale, framePos.Y.Offset + delta.Y)
end
end)
-- Input box to type team name
local TextBox = Instance.new("TextBox")
TextBox.Size = UDim2.new(0, 220, 0, 30)
TextBox.Position = UDim2.new(0.5, -110, 0, 50)
TextBox.PlaceholderText = "Enter team name..."
TextBox.Text = ""
TextBox.BackgroundColor3 = Color3.fromRGB(70, 70, 70)
TextBox.TextColor3 = Color3.fromRGB(255, 255, 255)
TextBox.Font = Enum.Font.SourceSans
TextBox.TextSize = 18
TextBox.Parent = Frame
-- Button to create team
local Button = Instance.new("TextButton")
Button.Size = UDim2.new(0, 150, 0, 40)
Button.Position = UDim2.new(0.5, -75, 0, 100)
Button.BackgroundColor3 = Color3.fromRGB(100, 100, 100)
Button.TextColor3 = Color3.fromRGB(255, 255, 255)
Button.Font = Enum.Font.SourceSansBold
Button.TextSize = 20
Button.Text = "Create Team"
Button.Parent = Frame
-- When clicked: create team and put yourself in it
Button.MouseButton1Click:Connect(function()
local teamName = TextBox.Text
if teamName == "" then return end
-- Check if team already exists
local existingTeam = Teams:FindFirstChild(teamName)
if existingTeam then
Player.Team = existingTeam
else
-- Create new team
local newTeam = Instance.new("Team")
newTeam.Name = teamName
newTeam.TeamColor = BrickColor.Random() -- random color
newTeam.Parent = Teams
Player.Team = newTeam
end
end)No comments yet for this script.



