Making A double Jump

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

There is not really a need for any ints or arithmetic subtractions for debounces here. We are talking about double jumps.

image
shows this

What does that mean? I haven’t saw that kind of error output type.

It’s roblox’s syntax highlighting breaking again, it’s not an error, just try the script.

Also can you show us the script you used? I don’t know if your using mine or that modeler guy.

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?

whats an in64 xxlamlnevitables

Well, it worked anyways :shrug:

gyazo.com/83fa7a6f523bc9a02a9b56d04ce5c1bd

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.

Well, i don’t program that kind of stuff anyways so i’m unbeknownst to this state stuff.

Use my block of code as reference.

yeahh i don’t get what you mean except

int64 are numbers with no decimal points for examples:

1, 2, 3, 420, 69, 101, 404, 800637

and numbers with decimal points are considered floats like:

1.69, 6.312, 9.1021, 62.1


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

well its already solved, time to raid the newest recent topic

if a script is disabled it cant reenabled itself

His talking about disabling the other script then enabling it back, anyways the issue about the double jump is over.

1 Like