How do I disable character controls on the server? [Dec 2024]

Hey guys,
I’m making an experimental line sim and I want to turn off the ability for players to move their character (run, jump, climb, etc…).

I’m trying to do this server-side so exploiters can’t inject code into the client. However, whenever I try to do this, the server cannot recognize anything under the player. It will only work if I put the code in the client…

The code for this, I have placed in a PlayerAdded event function, but the serve still does not recognize it. I have also tried event functions and it does the same thing.
PlayerScripts is not a valid member of Player "Players.XxFreedomxGamerxX" - Server

I have tried putting it in a PlayerAdded event but it still doesn’t recognize… Even remote events and functions don’t work. I had been following the advice from this post in 2020, but I’m afraid it might be outdated…

Thank you for your help guys

1 Like

Just anchor the humanoid root part?

You’ll need to do it on the client for anything that isn’t too invasive. You are getting the error “PlayerScripts is not a valid member of…” because PlayerScripts are loaded on the client. If it were me, I would disable controls on the client using Controls:Disable() (PlayerScripts module) and then detect on the server if they’re moving when they are not supposed to be.

But, I don’t want exploiters to change it… Is there really no other way because I need only the client to be able to change it.

Character controls and inputs are on client either way. Hackers can still move themselves on client so you’re just gonna have to make a server check if they’re moving or not.

1 Like

I see, I haven’t tried that yet. Thank you!