-
I want to achieve this: When the player holds down the spacebar it will make the jump higher, but if they tap it, they won’t go as high if they were to hold the spacebar
-
The issue is that the timer is going above the value I want it to be and when I tap the spacebar it doesn’t jump, I think I need to make adjustments to b:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
-
I was browsing so much on the dev hub looking for the solution, it fixed most of the issues for the jumping, I just need it to work when tapping it lightly and I want the loop for the jumppower to not go above 30 so players don’t jump too high
Basically tapping for a low jump and holding it for a higher jump
local UserInputService = game:GetService("UserInputService")
local a = game.Players.LocalPlayer.Character
local b = a:FindFirstChild("Humanoid")
local notJumping = b.Jump == false
local isJumping = b.Jump == true
b:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) print("canT jump bro")
UserInputService.InputBegan:Connect(function(inputObject, gameProcessed)
if gameProcessed then return end
wait(0.2)
if inputObject.KeyCode == Enum.KeyCode.Space then
b:SetStateEnabled(Enum.HumanoidStateType.Jumping, false) print("cant jump bro")
while wait(0) do
b.JumpPower = b.JumpPower + 1
if b.JumpPower == 30 then break
end
end
UserInputService.InputEnded:Connect(function(inputObject, gameProcessed)
if gameProcessed then return end
if inputObject.KeyCode == Enum.KeyCode.Space then print("Player has stopped holding down spacebar")
b:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)print("can jump")
wait(0.1)
b.WalkSpeed = 13
b.Jump = true
if Enum.HumanoidStateType.Jumping == false then
wait(1)
b:GetState() if Enum.HumanoidStateType.Jumping == false then
wait(0.2)
b:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)print("bruh")
b.WalkSpeed = 16
b.JumpPower = 0
end
end
end
end)
end
end)