I have a simple script that works fine when in Studio Solo mode, but when on any kind of server (even with just one person), it doesn't work.
script.Parent.MouseButton1Click:connect(function(player)
game.Players.LocalPlayer.Character:MoveTo(Vector3.new(-5, 1.89, -61.6))
end)
It just gives the error "attempting to index field 'LocalPlayer' (a nil value)". I have a LocalScript in the StarterGui.

2 comments
So I just moved my script over onto a LocalScript and it worked. But why is that? How does having it in a LocalScript vs. a script change anything?
Wait, I'm just stupid. I forgot that the LocalPlayer property only works when it is used in a LocalScript, not regular scripts. That was my problem. Thanks for the help!