Hi! I'm making a tycoon and I ran into a problem. I wanted to make the player only touch the button if he was in the right team and I used this and it doesn't work:
1 | if player.Team.Red then |
2 | -- scripts that you do not need to read |
3 | end |
1 | script.Parent.Touched:Connect( function (hit) |
2 | local player = game.Players:FindFirstChild(hit.Parent.Name) |
3 | if not player then return end |
4 | if player.Team.Name = = "Red" then |
5 | -- scripts that you do not need to read |
6 | end |
7 | end ) |
In a serverscript:
1 | script.Parent.Touched:Connect( function () |
2 | if player.Team.Name = = "Red" then |
3 | -- scripts that you do not need to read |
4 | end |
5 | end ) |
1 | local player = game.Players.LocalPlayer |
2 |
3 | if player.TeamColor = = "Really Red" then |
4 | -- scripts that you do not need to read |
5 | end |