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

I cant jump out of the car seat because i turned jump power to zero is there script? [closed]

Asked by 3 years ago

SO basically im making a game with guns and i made it so you cant jump because i think its cheap dodging and i want to make cars, so i used the old car model made by roblox because I dont trust any model unless roblox trusts it or its made by them https://web.roblox.com/library/59524676/Car so pls help idk what to do

0
When the person sits in the car, make their jump power default and when they leave the seat make it 0. Otherwise post your code if you have any so we can actually help you. sean_thecoolman 189 — 3y

Closed as Too Broad by DeceptiveCaster

This question has been closed because it is too broad and is generally unanswerable. Please ask a more specific question.

Why was this question closed?

4 answers

Log in to vote
0
Answered by 3 years ago

Make the jump power really small, like 0.1 or something, other than that I do not really know how to help you.

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

Hello there! This seems like a fairly simple problem to fix.

While you're sitting in the car, you can set the player's JumpPower to 16 (default value), like so. (Put the script inside the VehicleSeat)

local Players = game:GetService("Players")
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    local char = seat.Occupant.Parent -- The character of the player that is sitting in the seat
end)

Now that we've done that, we just have to set the player's JumpPower to 16!

local Players = game:GetService("Players")
seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    local char = seat.Occupant.Parent -- The character of the player that is sitting in the seat
    char.Humanoid.JumpPower = 16 -- Setting Player's JumpPower
end)

Now that's fine and dandy, but you have to set the JumpPower to 0, when you leave the seat.

Don't worry! We can just add a simple if statement!

local Players = game:GetService("Players")

local char -- This variable has been moved outside to make it global.

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    -- Moved above
    if seat.Occupant ~= nil then
        char = seat.Occupant.Parent
        char.Humanoid.JumpPower = 16
    else
        char.Humanoid.JumpPower = 0 -- This will work because the old occupant will be the current "char" variable
    end
end)

Anyway, I hope my explanation was helpful! If there are any problems, just leave a comment!

  • ProvingTrottle
Log in to vote
0
Answered by 3 years ago

You could say: humanoid.JumpPower = 0;

That would do the job fine. Although, I think it's cleaner and better to use Humanoid:SetStateEnabled()

Here is how you use it:

Humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false);

Log in to vote
0
Answered by 3 years ago

You Could do like ProvingTrottle , or just set jump power to 0.1