Hey Devforum,
So I want to make a team GUI that if you have the correct group rank or higher you can select that team.
And I am kinda new to scripting so I would appreciate some help.
Here is a piece of the script I use for every button.
local plr = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Parent.Name
script.Parent.MouseButton1Click:connect(function()
if plr:GetRankInGroup(6590599) >= 3 then
game.Players[plr].TeamColor = BrickColor.new("Daisy orange")
game.Workspace[plr].Humanoid.Health = "0"
end)
However if I use the script without the if statement it does work.
Can someone tell me what’s wrong?
You have forgotten to put an “end” to the if statement in order to close it.
Here is your fixed script.
EDIT: I have edited the script because I didn’t test the script beforehand, whoops!
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:connect(function()
if plr:GetRankInGroup(6590599) >= 3 then
game.Players[plr.Name].TeamColor = BrickColor.new("Daisy orange")
game.Workspace[plr.Name].Humanoid.Health = "0"
end
end)
You need to change their team in server script, because if you do it on the client that person will be in a team and others wont see it.
Edit: You can just change the players team and do: player:LoadCharacter()