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)
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?
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.
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)
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)
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.
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.