how do i add a debounce to jumping
1 Like
You’ll need to implement a custom jump script and disabled the default jump, here is a local script I just made to allow a player to jump every second.
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local ContextActionService = game:GetService("ContextActionService")
ContextActionService:UnbindAction("jumpAction")
-- Disable default jumping
humanoid:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
local jumpDelay = 1 -- Delay in seconds
local isJumping = false
local function onJumpAction(actionName, inputState, inputObject)
if inputState == Enum.UserInputState.Begin then
isJumping = true
while isJumping do
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
wait(jumpDelay)
end
elseif inputState == Enum.UserInputState.End then
isJumping = false
end
end
-- Bind the jump action
ContextActionService:BindAction("CustomJump", onJumpAction, false, Enum.KeyCode.Space)
1 Like
why is it letting me jump infinitely?
1 Like
The local script I sent should work, just place it in the StarterPlayerScripts folder
it doesnt work did you try it if so can you show me a video of it working?
Make sure it is in a local script that is placed in StarterPlayerScripts within the StarterPlayer folder
1 Like
oh okay thanks i read it wrong i didnt see you said to put it into StarterPlayerScripts
1 Like
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.