Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you create a team On click from a GUI?

Asked by 6 years ago

By A team on click I mean if you are in a certain group and click a TextButton it creates a team and assigns you that team. But, It needs to create the team when you click it because I don't want the server full of teams.

???? Thanks, Croc

1 answer

Log in to vote
0
Answered by
s_21 74
6 years ago

You can use the MouseButton1Down event, create the team, and set the player's Team property to it.

As for the group checking.. look use the IsInGroup function.

local plr = game.Players.LocalPlayer
local group = 000000

script.Parent.MouseButton1Down:Connect(function()
    if plr:IsInGroup(group) then
        local newTeam = Instance.new("Team",game.Teams);
        plr.Team = newTeam;
    end
end)

Once the player leaves the Team, The new team will still be there.

CREDIT TO GOULSTEM

Ad

Answer this question