Player *sometimes* cannot Jump while Sprinting

Hi guys,

I have run into an issue where whenever the player is Sprinting and presses Space to Jump, the character will only Jump sometimes.

It is kind of hard for me to explain clearly, but there is maybe a 50/50 chance that the character actually jumps.

Here is the code from my sprinting script; I am guessing that it is just too simple right now?

local BoostSpeed = 28
local NormalSpeed = 16

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		humanoid.WalkSpeed = BoostSpeed
	end
end)

UIS.InputEnded:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.LeftShift then
		humanoid.WalkSpeed = NormalSpeed
	end
end)

Is there another script that messes with the jumping property of the humanoid?

1 Like

Well to begin with I am using Gravity Controller, which has changes made to the base Roblox PlayerModule and ControlModule.
^ This also effectively deactivated the base humanoidState system and replaced it with a custom one.

On top of that, I also have a DoubleJump and Charged Jump script:

Double Jump:

Summary

local canDoubleJump = false
local hasDoubleJumped = false
local oldPower
local jump_multi = 1.3

function onJumpRequest()
	if not character or not humanoid or not character:IsDescendantOf(workspace) then
		return
	end

	if canDoubleJump and not hasDoubleJumped then
		print("DOUBLE JUMP SHOULD HAVE HAPPENED-----------------------------------")
		hasDoubleJumped = true
		humanoid.JumpPower = oldPower * jump_multi
		humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
		wait()
		humanoid.PlatformStand = true
	end
end

local function characterAdded(new)

	hasDoubleJumped = false
	canDoubleJump = false
	oldPower = humanoid.JumpPower
	
	
	State.Changed:Connect(function(old, new)
		if State.Value == "onRunning" then
			canDoubleJump = false
			hasDoubleJumped = false
			humanoid.JumpPower = oldPower
			humanoid.PlatformStand = true
		elseif State.Value == "onFreeFall" then
			wait()
			canDoubleJump = true
			hasDoubleJumped = false
		end
	end)
end

if player.Character then
	characterAdded(player.Character)	
end

Charge Jump:

Summary

I had a similar issue in this post, where I when I was trying to create the Charged Jump, the Jump was not working at all.
^ You can see the solution to this was pretty complicated, and the Charged Jump was added directly into the ControlModule, as well as some of the Children Script under it being changed.

For reference, the test place for this is open sourced, so feel free to look through it, as I might have missed some changes.