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

Why won't this script work? It's a rank team change GUI. Please help!

Asked by 9 years ago
function Click(mouse) -- Clickity click
if Player:GetRankInGroup(944397) == 10 then
print("Player is a FI+ YAY!") --If FI+
script.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Bright red") --Team color
script.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0 --Kills the player.
else
 print("Player not a FI")  --If not FI+
end
end)
script.Parent.MouseButton1Down:connect(Click)

I do not understand why it won't work.

0
Notso is correct that you should make a variable instead of that big long path, but your main problem is an unneeded parentheses on line 9. You should have included the output, there would have been an error. Perci1 4988 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

I agree with the above, the variable Player was not properly defined. However, since you seem to only have 2 teams I personally would do away with the GUI idea instead. If you had people who met the requirements for multiple teams a GUI would make sense so they could select a team. Yet, you don't seem to have that. Instead, if I myself was in this scenario would just write an Auto Team on Join script. I enclosed one I used a long while back below for you to reference from.

local ID = 760517

game.Players.PlayerAdded:connect(function(player)   
player.CharacterAdded:wait()
if player:GetRankInGroup(ID) == RANKTHATCANACCESS then
    player.TeamColor = game.Teams["FIRST TEAM NAME"]
    player:LoadCharacter()
        else
    player.TeamColor = game.Teams["SECOND TEAM NAME"].TeamColor
        player:LoadCharacter()
end
end
Ad

Answer this question