How to keep all players in seats via serverscript?

Currently scripting an awards theater for a group I’m working with, currently trying to find out how to keep players from leaving seats via a serverscript (not a localscript, as it could be disabled easily). Been trying at this for a while and haven’t found a working solution that is serversided. Thanks for reading!

1 Like

When somebody sits down, you could probably set their JumpPower to 0 when they sit, and when you want them to get out, you can set their JumpPower back to the regular amount and make then jump.
When the JumpPower is set to 0, it means that the jump velocity is 0 which means that the player won’t jump at all.

1 Like

I believe that only works with localscripts though? Setting jump-power.

I’ll go ahead and test it with a server script. I’ll edit this when I get more information.
EDIT: It appears to work with a server script and a local script.

1 Like

hmm, I’ll test it, if It works, I’ll just mark your reply as the solution, but I believe the localplayer can always just set his/her own jump-power, since localplayer physics are handled via the client.

Jump power should not be changed locally, unless you have a local script that changes it, or you have an exploiter.

exactly, I’m trying to protect against exploiters, lol

Clients have control over their character’s position replication, so setting their jump power to something won’t help much with this. You check to see if they move when they’re supposed to be sitting, though, and perhaps deal with that.

1 Like

There really is no ideal solution.

If you set their JumpPower to 0 they can just change it locally. If you anchor their RootPart, they’ll just change it locally.

You might just have to live with the fact that some people will get out of their seats via exploits.

1 Like

Okay, Thanks.

You could force them to sit and anchor their rootpart, and check their position via serverscript and if they move out of the seat area just teleport and force them to sit again and repeat

or just force them to sit and if they move out of the area via exploits kick them because I doubt you want exploiters in your game

1 Like

A similar question was asked earlier. It pertained to how to prevent players from automatically jumping, but the main point of the question was how to prevent jumping. See my response for the methods:

All in all though, jumping is a client-based action. You can’t prevent jumping on the server. Do what you can from the client and if people get out of their seats, tough luck, they’re probably exploiting. It doesn’t matter anyway; you shouldn’t be trying to handle this from the server just because of the threat of exploiters. What’s the least someone can do, “jump out of their seats during an announcement”? I’m sure you’ll probably have an admin script in your game. Kick them.

1 Like

After testing the “anchored root method” in studio, I think anchoring their root part on the server would be a liable way to keep people in their seats. The only issue would be if they broke out on the client, you would be able to see them running, wherever they were seated.
However:

  • For everyone else on the server, the person in the seat will still “be” in the seat, but for the player who unanchored themselves, they would be able to free roam within their client.

I believe that, given your game is an awards theater and you’ll be hosting awards on and off, anchoring the humanoidroot of the player on the server is a liable method to follow up with. The only potential issue you’d have is either reseting or the player messing with their character in ways that can be replicated.

Example of this in action:

1 Like

You can set JumpPower via a serverscript. I use this in a VehicleSeat in cars to prevent players leaving the car.

function onTouched(hit) 
local human = hit.Parent:findFirstChild("Humanoid") 
if (human ~= nil ) then 
hit.Parent.Humanoid.JumpPower = 0
script.Disabled = true
end 
end 

script.Parent.Touched:connect(onTouched)

Basically, if a player comes into contact with the vehicleseat, they’d sit down, and be unable to remove them self from the seat. Works serverside just fine.

2 Likes

Do you want them to be able to get up after sitting down?

If not then I have a solution.