Is there something wrong with my code?

So, i have been looking at the api references and i was looking at players. I stumbled across CameraMaxDistance so i copied and pasted it and got this error:

And this is the code if you were wondering.

I am a beginner scripter and would appreciate if one of you guys can help.

That’s because you’re trying to use LocalPlayer in a server script. LocalPlayer can only be used in client scripts, and it references the player that the script is running for. Players.LocalPlayer is nil on the server because there is no local player. You’d need to get the player some other way,

1 Like

Agh how stupid of me i should’ve known thank you very much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.