So I'm making a game (duh) and I want it so if your on a team, then you will be spit onto one of four spawn points.
Here's the script:
KnightSpawnPoint = math.random(1,4)
if game.Players.LocalPlayer.TeamColor == "Really Red" and KnightSpawnPoint == 1 then
game.Players.LocalPlayer.Character.Head.CFrame = CFrame.new(447, 105.225, 299.22)
elseif game.Players.LocalPlayer.TeamColor == "Really Red" and KnightSpawnPoint == 2 then
game.Players.LocalPlayer.Character.Head.CFrame = CFrame.new(312.7, 105.225, 303.22)
elseif game.Players.LocalPlayer.TeamColor == "Really Red" and KnightSpawnPoint == 3 then
game.Players.LocalPlayer.Character.Head.CFrame = CFrame.new(315.7, 108.713, 432.77)
elseif game.Players.LocalPlayer.TeamColor == "Really Red" and KnightSpawnPoint == 4 then
game.Players.LocalPlayer.Character.Head.CFrame = CFrame.new(446.775, 108.713, 432.77)
end
Now when I do this I get this error:
13:56:20.867 - Workspace.Script:2: attempt to index field 'LocalPlayer' (a nil value)
Can you please help me with this problem, much appreciated.

3 comments
A server script has no concept of a local player since it runs for all players. You will need to get the player to change their CFrame. Local script run in one place the client side so it knows who it is running for.
Without additional information I cannot help.
It's a script in the workspace.