I've got a server script which is supposed to check for a players team. Server scripts do not recognise LocalPlayer as a variable, so I was wondering, what do I do?
function ColorChange() if game.Players.LocalPlayer.Team.TeamColor == BrickColor.new("Dusty Rose") then print("Dusty Rose") elseif game.Players.LocalPlayer.Team.TeamColor == BrickColor.new("Sand blue") or game.Players.LocalPlayer.Team.TeamColor == BrickColor.new("Steel blue") then print("Sand blue or Steel blue") end end script.Parent.ClickDetector.MouseClick:connect(ColorChange)
I left some comments below, please read.
script.Parent.ClickDetector.MouseClick:Connect(function(Player) --MouseClick takes a parameter of the Player. if Player.Team.TeamColor == BrickColor.new("Dusty Rose") then -- You can't get the LocalPlayer in a server script. print("Dusty Rose") elseif Player.Team.TeamColor == BrickColor.new("Sand blue") or Player.Team.TeamColor == BrickColor.new("Steel blue") then print("Sand blue or Steel blue") end end)
If this helped, please accept :)