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

Why does my script not make the JumpPower 0 when seated?

So i have this simple script which is supposed to set the jump power to 0 when the player is in a vehicle seat so that you cant jump out of it but for some reason it does not work.Whats the issue and how do i fix it?

the script

repeat wait() until game.Players.LocalPlayer
local player = script.Parent.Parent
if player.Character.Humanoid.Seated == true then
	player.Character.JumpPower.value = 0
end

4 comments

0

Don't do .value

0

Just do player.Character.JumpPower = 0

0

@Spjureeedd no it's not player.Character.JumpPower = 0

0

Oh yeah lol hehe

1 answer

✓ Accepted answer

The problem is that the jumppower is not located in the character, its located in the humanoid, also seatted is an event not a bool, so try this

-- Inside StarterGui
local player = game.Players.LocalPlayer
local character = player.CharacterAdded:Wait() -- Waiting for character
local humanoid = character:WaitForChild("Humanoid")

humanoid.Seatted:Connect(function(isSeatted,seat)
	if seat:IsA("VehicleSeat") and seat.Name == "YourvehicleSeatNameHere" and isSeatted then
		humanoid.JumpPower = 0 -- JP is a property of the humanoid
	end
end)

2 comments

0

Didn't really think about that hehe

0

Thanks for the help. Sorry for responding 18 days late tho :D

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