How do I disable jumping for the player upon touching an object?
4 Likes
You can also try disabling the jump state
https://developer.roblox.com/en-us/api-reference/function/Humanoid/SetStateEnabled
7 Likes
set the jump power of the player to 0
put a part and insert this script in
script.Parent.Touched:Connect(function(h)
local d = h.Parent:FindFirstChild("Humanoid")
if d then
d.JumpPower = 0
end
end)
21 Likes
Hi there! You can disable jumping in Roblox Studio. You can disable it on Settings/World. You can also disable jumping with a Humanoid Script on GUI!
5 Likes
Thank you fam. Worked like a treat.
1 Like
Hello, I would just like to add that for it to work for me, I had to set UseJumpPower to true. Add this to your code if it doesn’t work.
humanoid.UseJumpPower = true
5 Likes
Going to ask, is this for Localscript or Script as a serverscript?
1 Like
Must be a Script in ServerScriptService for security reason.
local Part = game.Workspace:WaitForChild("Part")
Part.Touched:Connect(function(otherPart)
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
if humanoid then
humanoid.JumpPower = 0
else
return
end)
Was looking for a jump power alternative. Thank you!
script.Parent.Touched:Connect(function(h)
local d = h.Parent:FindFirstChild("Humanoid")
if d then
d.JumpPower = 0
end
end)
1 Like