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

Why does my team/rank script not work?

Hi,

Basicily when a player clicks his button it is supposed to check if the user is that certain rank in that group if they are then they are teamed. if not then the click is ignored.

I don't know why it does not work.

function Click(mouse)
if script.Parent.Parent.Parent.Parent.Parent.Parent:GetRoleInGroup(798194) == 254 then
		script.Parent.Parent.Parent.Parent.Parent.Parent.TeamColor = BrickColor.new("Sand blue")
		script.Parent.Parent.Parent.Parent.Parent.Parent.Character.Humanoid.Health = 0

	 else
	end
end


script.Parent.MouseButton1Down:connect(Click)

1 answer

This may not be your problem, but just a suggestion:

Use a LocalScript for this instead of using all those parents. You also don't need the else statement, it will automatically ignore the request if the if statement is not met.

script.Parent.MouseButton1Down:connect(function()
player = game.Players.LocalPlayer -- Gets the player
if player:GetRoleInGroup(798194) == 254 then
        player.TeamColor = BrickColor.new("Sand blue")
        player.Neutral = false -- Player can't be neutral, don't know if that'll help, but good practice.
        player.Character.Humanoid.Health = 0
end
end)

2 comments

0

ok thanks I will try it.

0

Does not fix the problem.

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