Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

1 comment

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.

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.