Double jump Broke

So I followed a tutorial on YouTube by(Axmist) on how to make a double jump script, it worked after i completed the tutorial, but today I decided to test it and it does not work
video



Script!
local UserInputService = game:GetService(“UserInputService”)

local character = script.Parent
local humanoid = character:WaitForChild(“Humanoid”)

local Animation = Instance.new(“Animation”)
Animation.AnimationId = “rbxassetid://7189582341”

local DoubleJump = humanoid:LoadAnimation(Animation)

local HasDoubleJump = false
local LastJump = tick()
local function jumpRequest()
if tick() - LastJump >= .2 then
if humanoid:GetState() == Enum.HumanoidStateType.Freefall and not HasDoubleJump then
HasDoubleJump = true
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
DoubleJump:Play()
end
end
end

humanoid.StateChanged:Connect(function(old , new)
if new == Enum.HumanoidStateType.Landed then
HasDoubleJump = false
end
if new == Enum.HumanoidStateType.Jumping then
LastJump = tick()
end
end)

UserInputService.JumpRequest:Connect(jumpRequest)

1 Like

The code seems fine to me, can you show in explorer where the script is located? It should be a localscript in StarterCharacterScripts

1 Like

my bad i was editing the post it should be up now i screenshotted properties tab

1 Like

could there be a problem with the parameters, like for the function jumpRerquest was i suppose to put sum in those parameters

I think I am gonna try a more recent tutorial that one i was watching was 11 months ago mabey something in the script is outdated

1 Like

Readable code:

local UserInputService = game:GetService(“UserInputService”)
local character = script.Parent
local humanoid = character:WaitForChild(“Humanoid”)

local Animation = Instance.new(“Animation”)
Animation.AnimationId = “rbxassetid://7189582341”

local DoubleJump = humanoid:LoadAnimation(Animation)

local HasDoubleJump = false
local LastJump = tick()
local function jumpRequest()
if tick() - LastJump >= .2 then
if humanoid:GetState() == Enum.HumanoidStateType.Freefall and not HasDoubleJump then
HasDoubleJump = true
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
DoubleJump:Play()
end
end
end

humanoid.StateChanged:Connect(function(old , new)
if new == Enum.HumanoidStateType.Landed then
HasDoubleJump = false
end
if new == Enum.HumanoidStateType.Jumping then
LastJump = tick()
end
end)

UserInputService.JumpRequest:Connect(jumpRequest)

Have you tried adding print statements to see where it fails?

2 Likes

Roblox seems to have made a change to UserInputService.JumpRequest. Instead of firing whenever the spacebar or mobile jump button is pressed (even if you are in the air), it now only seems to fire when your character is on the ground.

1 Like

I decided to try a different tutorial on that was uploaded 2 months ago by (cybercreator)
video


for some reason it says i am jumping when i am not jumping lol

I decided to try a different tutorial on that was uploaded 2 months ago by (cybercreator)
video


for some reason it says i am jumping when i am not jumping

code

hey, try this, i changed some stuff

local UserInputService = game:GetService("UserInputService")

local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://7189582341"

local FlipAnim = humanoid:LoadAnimation(Animation)

local HasDoubleJumped = false
local LastJump = tick()
local function jumpRequest()
	if (tick()- LastJump) >= .1 then
		if humanoid:GetState()== Enum.HumanoidStateType.Freefall and not HasDoubleJumped then
			HasDoubleJumped = true
			humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
			FlipAnim:Play()
		end
	end
end

humanoid.StateChanged:Connect(function(old,new)
	if new == Enum.HumanoidStateType.Landed then 
		HasDoubleJumped = false
	elseif new == Enum.HumanoidStateType.Jumping then
		LastJump = tick()
	end
end)

UserInputService.JumpRequest:Connect(jumpRequest)
1 Like

Try this code:

local UserInputService = game:GetService("UserInputService")
local character = script.Parent
local humanoid = character:WaitForChild("Humanoid")

local Animation = Instance.new("Animation")
Animation.AnimationId = "rbxassetid://7189582341"

local DoubleJump = humanoid:LoadAnimation(Animation)

local HasDoubleJump = false
local LastJump = tick()
local function jumpRequest(input, typing)
	if typing then
		return
	end
	
	if input.KeyCode == Enum.KeyCode.Space then
		if tick() - LastJump >= .2 then
			if humanoid:GetState() == Enum.HumanoidStateType.Freefall and not HasDoubleJump then
				HasDoubleJump = true
				humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
				DoubleJump:Play()
			end
		end
	end
end

humanoid.StateChanged:Connect(function(old , new)
	if new == Enum.HumanoidStateType.Landed then
		HasDoubleJump = false
	end
	if new == Enum.HumanoidStateType.Jumping then
		LastJump = tick()
	end
end)

UserInputService.InputBegan:Connect(jumpRequest)
2 Likes

This seems to be a bug that was introduced today. My game has deployable gliders that have been working for months just fine, and suddenly broke today. (No code changes on my end.)

I did some troubleshooting and the problem is that the UserInputService.JumpRequest is not firing when the character is in the air. (This used to work prior to today.)

So when the character is already jumping, the event “JumpRequest” is not firing again until they land. I have been working on my game all day and this is something that suddenly broke within the last few hours.

3 Likes

thats exactly what happed to me everthing was working excellent yesterday but today its like Y E E T

2 Likes

Thank you so much i will try these codes in a minute I am about to eat dinner well lunch kind of its 6:28 pm

1 Like

I rlly do appreciate you taking time out to make this code for me a will try it out soon about to eat some food thx once again lol

1 Like

Some bug fixes were enabled earlier today, which might have accidentally caused this problem. I’ve turned them off. Let me know if it fixes the issues

1 Like

Oh it’s no problem, all I did was copy your code and use “InputBegan” instead of “JumpRequest” and checked if the Input was spacebar. I got it to work for me, so hopefully it will for you.

1 Like

For real good looking out for the K I D

i may sound like a bot but I am sorta new to roblox studios how do I turn off bug fixes lol