Changing the players state on the server

  1. What do you want to achieve? I want to be able to ragdoll a player, while not dead, and preferably using ChangeState as I think this results in the smoothest ragdoll (R15).

  2. What is the issue? Well, you can only use ChangeState on a local script. I’m hoping to find a workaround

  3. What solutions have you tried so far? I’ve tried searching other ways and all I’ve seen is making the network ownership nil, then auto-setting the network ownership. Though this does allow ChangeState to run on the server it’s extremely glitchy and not as I would like it to be.

The base of the ragdoll script is from:

All I’ve done is made it so that when the player’s health is under 26, they ragdoll, then get back up once their health is more than 26. I did this by simply changing the state of the humanoid to “Physics” and then disabling the animate script, vice versa for getting up. As I stated though, changing the state of the humanoid can only be done on the client, not the server.

Have you considering using FireAllClients to achieve the same result? You can’t really change state on the server without binding the ChangeState to a RenderStepped loop. Not sure how well that works either.

the only issue with this is security, this method would allow exploiters to remove the script which causes them to ragdoll, essentially never ragdolling.

Ok so I’ve been playing around with this trying to force the player state into one of the physics states so I can fling the player. There are 2 solutions.

First solution: Inject a LocalScript under character from the server. This one sounds hacky, but so far this gave the best results and there is no need for remote events whatsoever.

Best part is that I tried this with a script that was supposed to dispose of any injected scripts instantly (assuming this is what the exploiter would try to do), but despite the exploit script running faster Roblox will give a warning that something tried to unparent our script, while we were trying to parent it and it will still run!

  • Create the LocalScript you want to inject into the player
  • Store it inside ServerStorage for security measures
  • Make sure the script auto-destroys itself as soon as it finishes the job
  • On server side, just clone the script and set it’s parent as the player character and it will auto-run

Pros:

  • Lag free and works on laggy clients as well at least in my case it did
  • Exploiter tempering script seems unable to stop it’s execution in time

Cons:

  • A future Roblox update may change it’s strength in security, meaning it will be possible to temper with it… but I guess this is just a speculation.

Second solution: Change network ownership of player to the server and then change the players state.
Issues with this is that you need to keep the ownership active for a short period of time.
In my case it was the following:

  • rootpart:SetNetworkOwner(nil) → sets it to server
  • apply velocity to player
  • wait around 0.2-0.5 second and give network ownership back to the player

Pros:

  • As exploit proof as it can get

Cons:

  • It causes a noticeable lag each time we change the ownership, in my case 2 times which in my case kind of ruins the fluidity of the whole game.

I hope these help :smile:

6 Likes