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
Make the jump power really small, like 0.1 or something, other than that I do not really know how to help you.
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
)
1 | local Players = game:GetService( "Players" ) |
2 | seat:GetPropertyChangedSignal( "Occupant" ):Connect( function () |
3 | local char = seat.Occupant.Parent -- The character of the player that is sitting in the seat |
4 | end ) |
Now that we've done that, we just have to set the player's JumpPower
to 16!
1 | local Players = game:GetService( "Players" ) |
2 | seat:GetPropertyChangedSignal( "Occupant" ):Connect( function () |
3 | local char = seat.Occupant.Parent -- The character of the player that is sitting in the seat |
4 | char.Humanoid.JumpPower = 16 -- Setting Player's JumpPower |
5 | 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!
01 | local Players = game:GetService( "Players" ) |
02 |
03 | local char -- This variable has been moved outside to make it global. |
04 |
05 | seat:GetPropertyChangedSignal( "Occupant" ):Connect( function () |
06 | -- Moved above |
07 | if seat.Occupant ~ = nil then |
08 | char = seat.Occupant.Parent |
09 | char.Humanoid.JumpPower = 16 |
10 | else |
11 | char.Humanoid.JumpPower = 0 -- This will work because the old occupant will be the current "char" variable |
12 | end |
13 | end ) |
Anyway, I hope my explanation was helpful! If there are any problems, just leave a comment!
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);
You Could do like ProvingTrottle , or just set jump power to 0.1
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?