Preventing jumping out of seat

I love seats and vehicle seats. They can be touch activated with no scripting, they can be manually set, they give the little seat part value in humanoid, that is visible client and server, they put you in a sitting state where your physics are turned off and they even play a nice little sitting animation depending on what you have in your animation script.

However, what I don’t like about them, is that its too difficult to prevent someone from jumping out of the seat.

I remember I had tried to disable seat jumping in the past, and after many tries, it somewhat worked, but was buggy, etc…

So, now that I need to use seats that will not let you jump free, I decided to ask here if there is any preferred way, or simple way to prevent players from jumping free from seats, unless I manually release them.

I appreciate any info or advice, as it will save me lots of time of trial and error, or searching for old code, that was very buggy to begin with.


I would just disable players movement when they are seated, this should work! I’ve had problems with this as well, you could also just anchor the player though this is for more stationary seats.

-- Client Script

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PlayerScripts = Player:WaitForChild("PlayerScripts")
local PlayerModule = require(PlayerScripts:WaitForChild("PlayerModule"))
local PlayerControls = PlayerModule:GetControls()

-- To disable

-- To Enable

you can use the following code inside startercharacterscripts as a local script

local character = game.Players.LocalPlayer.Character
local humanoid: Humanoid = character:WaitForChild("Humanoid")

humanoid.UseJumpPower = true

humanoid.Seated:Connect(function(active, seat)
	if active then
		humanoid.JumpPower = 0

would not recommend doing @TheDCraft as this can cause issues when the player dies as the player will not be able to move after resetting/dying. This also disables controls all together which can cause issues with stuff like the humanoid MoveDirection property. Which can make cars with custom control systems to break.

please mark as solution if this helps :slight_smile:

if you want this to happen to only a certain seat, you can do this. Server script inside your seat.

local seat = script.Parent

	local humanoid = seat.Occupant
	if not humanoid then return end	
	humanoid.UseJumpPower = true
	humanoid.JumpPower = 0	

Oh I wasn’t aware that is an issue, does it occur even when you enable it?

no it wont occur when u enable controls.

But if you want to disable jumping just set the jumppower to 0

1 Like

I should have stated, that these will be for vehicles, so they will need to move (non anchored) and still need to direct them by reading my own humanoid’s move direction.

I wasn’t aware that jump power of 0 would prevent seat exiting.

I will go play with that now, and experiment.

please mark my post as solution if it helped :slight_smile:

You can also disable the players jump state like this:

--Disable jump
LocalPlayer.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
--Enable jump
LocalPlayer.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)

Dont you have to do that on both the client and the server to get consistent results though?

I do it on the client and it works fine

ok im going to play with these ideas, and post my results

So apparently, by switching UseJumpPower to true and false, acts like a jump lock toggle as long as you keep your jump power to 0, and jump height to some non 0 value.

I love this. I didn’t try this in a client / server setup, but I doubt it would make a difference as these are all going to be server actions in my game.

Here is my test code if you want to check it out, just put it in a Server Script, and run game.

local part ="Part")
part.Anchored = true
part.TopSurface = Enum.SurfaceType.Smooth
part.BottomSurface = Enum.SurfaceType.Smooth
part.Size =,1,4)
part.Position =, 0.5, -18)
part.Parent = workspace

local seat ="Seat")
seat.BrickColor = BrickColor.Black()
seat.TopSurface = Enum.SurfaceType.Smooth
seat.BottomSurface = Enum.SurfaceType.Smooth
seat.CanCollide = false
seat.Size =, 1, 2)
seat.Position =, 1.5, -18)
seat.CanTouch = false
seat.Parent = workspace

local p1 = part:Clone()
p1.Size =,4,1)
p1.Position =, 2, -22.5)
p1.Parent = workspace

local p2 = part:Clone()
p2.Size =,1,2)
p2.Position =, 0.5, -19)
p2.Parent = workspace

local sitButton = part:Clone()
sitButton.Size =,1,1)
sitButton.Position =, 4, -22.5)
sitButton.Shape = Enum.PartType.Ball
sitButton.Parent = workspace

local ejectButton = sitButton:Clone()
ejectButton.Position =, 1, -19)
ejectButton.Parent = workspace

local sitClick ="ClickDetector")
sitClick.Parent = sitButton
local ejectClick = sitClick:Clone()
ejectClick.Parent = ejectButton

local weld ="WeldConstraint")
weld.Part0 = part
weld.Part1 = seat
weld.Parent = part

local canEject = false
local canSit = true

ejectButton.BrickColor = BrickColor.Red()
sitButton.BrickColor = BrickColor.Green()

local lastOccupant = nil
	local humanoid = seat.Occupant
	if humanoid then
		canSit = false
		humanoid.UseJumpPower = true
		humanoid.JumpPower = 0
		lastOccupant = humanoid
		canEject = true
		ejectButton.BrickColor = BrickColor.Blue()
		sitButton.BrickColor = BrickColor.Red()		
		canEject = false
		if lastOccupant then
			lastOccupant.UseJumpPower = false
			lastOccupant.Jump = true
		canSit = true
		ejectButton.BrickColor = BrickColor.Red()
		sitButton.BrickColor = BrickColor.Green()	

	if canEject then
		canEject = false

	if canSit then
		canSit = false

btw, when I post code, it always spaces it out, and doesnt indent
am I doing it wrong?
I use the [ code ] and [/ code]

Use backticks instead, a single pair for single line scripts and two sets of three for multi-line scripts.

print("Hello world!")

1 Like

oh awesome, thank you, it looks nice now!