#how to fix my animation repeatedly doing jump animation after just one double jump

1 messages · Page 1 of 1 (latest)

rigid harness
#

local Players = game:GetService("Players")
local UserInputService = game:GetService("UserInputService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local canDoubleJump = true
local canDoubleJumpAfter = 0.5 -- Cooldown between jumps
local jumpPower = 50 -- Power of the double jump
local jumpCount = 0 -- Counter for jumps

local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://102530887322106"
local track = humanoid:LoadAnimation(animation)

local function onJumpRequest()
if humanoid:GetState() == Enum.HumanoidStateType.Freefall and jumpCount < 1 then
track:Play()
track:GetMarkerReachedSignal("Jump"):Connect(function()
jumpCount = jumpCount + 1
humanoid:ChangeState(Enum.HumanoidStateType.Jumping)
humanoid:Move(Vector3.new(0, jumpPower, 0))
wait(canDoubleJumpAfter)
end)
end
end

UserInputService.InputBegan:Connect(function(input, gameProcessed)
if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == Enum.KeyCode.Space and not gameProcessed then
onJumpRequest()
end
end)

humanoid.StateChanged:Connect(function(_, newState)
if newState == Enum.HumanoidStateType.Landed or newState == Enum.HumanoidStateType.Running then
jumpCount = 0
end
end)

wanton kindleBOT
#

studio** You are now Level 2! **studio

rigid harness
#

so like this happens

red osprey
#

holy ur creating a shit ton of connections

versed stirrup
#

yeah idk whats happening for you but like it aint happening for me...

red osprey
versed stirrup
#

try getting rid of track:GetMarkerReachedSignal("Jump"):Connect(function() and just put the contents straight below the track:Play()

#

thats most likly your problem