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

Why does my team/rank script not work?

Asked by 9 years ago

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

Log in to vote
0
Answered by
Sublimus 992 Moderation Voter
9 years ago

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)
0
ok thanks I will try it. nestenes 0 — 9y
0
Does not fix the problem. nestenes 0 — 9y
Ad

Answer this question