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

If player is on a certain team?

Asked by 4 years ago

So I want to make a system where you can rob things, but of course only criminals should be able to. But for some reason my team checking script doesn't work.

This is the code I made:

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    if player.Team == game.Teams.Criminal then
        print("yes")
    end
end)

Please Help!

1 answer

Log in to vote
0
Answered by 4 years ago

Try this:

script.Parent.ClickDetector.MouseClick:Connect(function(player)
    if player.TeamColor == game.Teams.Criminal.TeamColor then
        print("yes")
    end
end)
0
It works, but only when I'm set to criminal as default. Don't know why. Recrucity 13 — 4y
0
Sorry, my bad. It's just a client / server communication error. Thank You! Recrucity 13 — 4y
Ad

Answer this question