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

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

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

1 comment

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.

4 answers

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)

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

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

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