Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 3 years ago

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!

0
Use Seat.Occupant on a serverscript ym5a 52 — 3y
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 RasbaKolaLegend 0 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

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.

0
Thanks! It worked :) I'll try to understand this script since my small brain didn't really understand RasbaKolaLegend 0 — 3y
0
Sorry but it didn't work few mins later RasbaKolaLegend 0 — 3y
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 SharkRayMaster 265 — 3y
0
No I didn't I some reason It stopped working RasbaKolaLegend 0 — 3y
0
oh wait it started working again idk why RasbaKolaLegend 0 — 3y
Ad

Answer this question