ok so 1st you add a local script in StarterCharacterScripts
now open up the local script then put
local character = script.Parent
since the local script is in StarterCharacterScript you dont need to say
local character = plr.Character or plr.Character:Wait()
Same with StarterPlayer Script you dont need to say
local plr = game.Players.LocalPlayer
--or
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
anyways
you then add the character Humanoid by doing this
local hum = character = character:WaitForChild("Humanoid")
--or
local hum = character.Humanoid
So
Now that you make a variable for humanoid we can now get into the main area
add a variable like
local isJumping = false
you can name it anything
after you do that
you say
hum.StateChanged:Connect(function(landed) --you can change landed to anything
you might be thinking
“What is StateChanged and why did you add humanoid?”
well first of all i added the Humanoid Because you need the humanoid to get StateChanged and other stuff like walkSpeed
and the StateChanged is basically what state are you in
Are you in avatar state?
are you in idle state?
it basically something that is needed to make the rest of the things im gonna be explaining work.
ok Next
add in
if landed == Enum.HumanoidStateType.Landed then
if you are new to if then or elseif then i reccomend watch some ytuber tutorials
and read this
and when you use if then you need to add an
“end”
at the end of the script
Next is optional
Add this
print("1")
wait(0.3)
print("2")
wait(0.3)
print("3")
wait(0.3)
wait(0.1)
basically how much more seconds you need to wait until you can jump again
as i said its optional
next
this is where the magic comes in
continuing from the
if landed == Enum.HumanoidStateType.Landed then
add in this
isJumping = true
hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
remember when i said isJumping = false?
well now we say isJumping = true because after we waited 3 seconds after we landed so now we can now jump
in order for the script to work properly add an
else statement
by doing this
else
add it right below the
isJumping = true
hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
after you added the else
you do the opposite because
its like
i drank water
i can now eat a fruit
but if i already ate a fruit
i will drink water
so the whole script will be like this
local character = script.Parent
local hum = character.Humanoid
local isJumping = true
hum.StateChanged:Connect(function(landed)
if landed == Enum.HumanoidStateType.Landed then
print("1")
wait(0.3)
print("2")
wait(0.3)
print("3")
wait(0.3)
wait(0.1)
isJumping = true
hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
else
isJumping = false
hum:SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
end
end)
also i forgot to explain why i added the end)
i added the end) because i had a function in
hum.StateChanged:Connect(function(landed)
this is my 1st ever tutorial im bad at teaching
if u ever see a mistake tell me
heres a video of me using it