The second argument on the inputbegan function is the game processed event, the first one is the key you pressed, it’s not supposed to be a variable though, or is it?
Edit: btw what’s taking you so long, nomcell to even copy these and say if it’s working or nat
I am not really the type of person to say this, but your code is not really done well, and I doubt it would function properly as it should. Why is the StateChanged event inside another event that is not related to it? Why are you using Int64’s for a debounce?
Int64s are basically numbers, but without decimal points. Numbers like 1, 4, 6 and all that. Of course, anything like 3.14, or 0.75 are floats (or floating point if you want to be fancy), which are called doubles in other programming languages.
Your code is still not done well and it is not really a good idea to be adding a listener for humanoid states inside an event that checks for any input.
local Player = game.Players.LocalPlayer
local Character
local CanDoubleJump = false
local HasDoubleJumped = false
local OldJumpPower
local DoubleJumpMulti = 1.5
local UIS = game:GetService("UserInputService")
Player.CharacterAdded:Connect(function(NewCharacter)
Character = NewCharacter
local Humanoid = Character:WaitForChild("Humanoid")
CanDoubleJump = false
HasDoubleJumped = false
OldJumpPower = Humanoid.JumpPower
Humanoid.StateChanged:Connect(function(Old, New)
if New == Enum.HumanoidStateType.Landed then
CanDoubleJump = false
HasDoubleJumped = false
Humanoid.JumpPower = OldJumpPower
elseif New == Enum.HumanoidStateType.Freefall then
wait(0.1)
CanDoubleJump = true
end
end)
end)
UIS.JumpRequest:Connect(function()
if Character then
if CanDoubleJump == true and HasDoubleJumped == false then
HasDoubleJumped = true
Character.Humanoid.JumpPower = OldJumpPower * DoubleJumpMulti
Character.Humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
end
end