You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to make it so when you hold spacebar, a percentage increases. And when you release, you jump with the increased percentage -
What is the issue? Include screenshots / videos if possible!
Getting it to work basically. I’ve tried many things and have gotten many problems. My biggest problem is the player jumping infinitely. Like the boost will work but the player just won’t stop jumping. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I’ve asked for help in many servers and looked on the developer hub. Unless I’m bad at searching, I’ve found nothing to help me out.
Heres the main code
-- this is inside the keyboard module in player scripts btw
UserInputService.InputBegan:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.Space then
CanJump = true
IncreaseJump = true
end
end)
UserInputService.InputEnded:Connect(function(Input, IsTyping)
if IsTyping then return end
if Input.KeyCode == Enum.KeyCode.Space then
CanJump = false
IncreaseJump = false
end
end)
-- bottom of the script
local handleJumpAction = function(actionName, inputState, inputObject)
self.jumpEnabled = CanJump
local Character = game.Players.LocalPlayer.Character
local Humanoid: Humanoid = Character:WaitForChild('Humanoid')
local JumpValue = 16
self.jumpRequested = self.jumpEnabled and inputState == Enum.UserInputState.End
self:UpdateJump()
Humanoid.JumpHeight = JumpValue * (1 + JumpPercentage / 100)
JumpPercentage = 0
return Enum.ContextActionResult.Pass
end
Thanks a lot