Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make a seat where you can't get out by jumping?

So I tried making this script by making local player jump power to be 0 but It didn't work This is the script I tried to make

game.Players.LocalPlayer.Character.Humanoid.JumpPower = 0

So please find a solution for me! btw I'm not necroposting since this method no longer works https://scriptinghelpers.org/questions/78987/how-to-disable-the-jumping-while-inside-a-vehicledrive-seat Anyways, Have a nice day!

2 comments

0

Use Seat.Occupant on a serverscript

0

What do you mean? I'm a starter to scripting I started 2 days ago so I don't really know very advanced stuff but I couldn't find an answer to the scripting docs as well sorry if I'm being dumb

1 answer

Ok so, I tried to find the guy who originally made this script but I couldn't

Basically, as "ym5a" said, use Seat.Occupant

Here's what you're looking for

local occupant = nil -- Nobody is sitting on the seat by default.
chair = script.Parent.Parent

script.Parent:GetPropertyChangedSignal("Occupant"):Connect(function()
	if script.Parent.Occupant then -- If there now is an occupant
		occupant = game.Players:FindFirstChild(script.Parent.Occupant.Parent.Name)
         --[[
             The occupant variable is now referring to the player that is occupying the seat.
             Note that the Occupant parameter returns the player's humanoid, not the player himself.
        --]]
	elseif not script.Parent.Occupant then -- If there is no occupant
		occupant = nil
	end
end)

while true do
	wait()
	if occupant then
		occupant.Character.Humanoid.JumpHeight = 0
		occupant.Character.Humanoid.JumpPower = 0
	end
end

Insert that code in a script inside the seat, if you wanna learn to do it yourself just try searching how to get the player sitting on a seat.

5 comments

0

Thanks! It worked :) I'll try to understand this script since my small brain didn't really understand

0

Sorry but it didn't work few mins later

0

What do you mean it didn't work later? Did you edit the script?, You just have to insert that code in a script, and the script inside the seat

0

No I didn't I some reason It stopped working

0

oh wait it started working again idk why

This discussion is preserved as it was. New answers, comments, and votes are closed.