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

If player is on a certain team?

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

✓ Accepted answer

Try this:

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

2 comments

0

It works, but only when I'm set to criminal as default. Don't know why.

0

Sorry, my bad. It's just a client / server communication error. Thank You!

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