The script is:
script.Parent.Touched:connect(function(hit)
green = game.Teams.Green
purple = game.Teams.Purple
if game.Players.LocalPlayer.Team == green then
script.Parent.BrickColor = BrickColor.new(0, 255, 0)
elseif game.Players.LocalPlayer.Team == purple then
script.Parent.BrickColor = BrickColor.new(170, 0, 170)
end
end)
If a player on the green team touches the part, it turns the part green, and if a player on the purple team touches the part, it turns the part purple. This works perfectly in studio, but in-game it doesn't. Please help!

1 comment
Is this a script or localscript? game.Players.LocalPlayer can only be used in local scripts.