Double Jump Animation Playing Over Climb Animation

I have a double jump script and a ledge grab script and when you grab the ledge you press jump to climb up however the animation for my double jump plays over it. I fixed part of it by changing animation priorities. It works for the most part but at the end of the climb animation the last little bit of the double jump animation plays, making it look weird.

Here are the scripts so you can fix it.

Double Jump:

local UIS = game:GetService("UserInputService")
local CanDoubleJump = true
local CanSetCanDoubleJumpToTrue = false
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

UIS.JumpRequest:Connect(function()
    if CanDoubleJump then
        Character:WaitForChild("Humanoid").JumpPower = Character:WaitForChild("Humanoid").JumpPower * 1
        Character:WaitForChild("Humanoid"):ChangeState(Enum.HumanoidStateType.Jumping)
        local Animator = Character:WaitForChild("Humanoid"):FindFirstChild("Animator") or Instance.new("Animator",Character:WaitForChild("Humanoid"))
        Animator:LoadAnimation(script.Flip):Play()
        CanDoubleJump = false
    end
end)

game.Players.LocalPlayer.Character:WaitForChild("Humanoid").StateChanged:Connect(function(old,new)
    if new == Enum.HumanoidStateType.Landed then
        CanDoubleJump = false
        CanSetCanDoubleJumpToTrue = true
        Character:WaitForChild("Humanoid").JumpPower = game:GetService("StarterPlayer").CharacterJumpPower
    elseif new == Enum.HumanoidStateType.Freefall then
        if CanSetCanDoubleJumpToTrue == true then
            wait(0.2)
            CanDoubleJump = true
            CanSetCanDoubleJumpToTrue = false
        end
    end
end)

Ledge Grab/Climb

local plr = game.Players.LocalPlayer
local Character = plr.Character or plr.CharacterAdded:Wait()
local Root = Character:WaitForChild("HumanoidRootPart")
local Head = Character:WaitForChild("Head")
local Hum = Character:WaitForChild("Humanoid")
local CA = Hum:LoadAnimation(script:WaitForChild("ClimbAnim"))
local HA = Hum:LoadAnimation(script:WaitForChild("HoldAnim"))
local TouchGui = plr:WaitForChild("PlayerGui"):FindFirstChild("TouchGui")
local UIS = game:GetService("UserInputService")

ledgeavailable = true
holding = false
while game:GetService("RunService").Heartbeat:Wait() do
	local r = Ray.new(Head.CFrame.p, Head.CFrame.LookVector * 5)
	local part,position = workspace:FindPartOnRay(r,Character)
	if part and ledgeavailable and not holding then
		if part.Size.Y >= 10 then
			if Head.Position.Y >= (part.Position.Y + (part.Size.Y / 2)) - 1 and Head.Position.Y <= part.Position.Y + (part.Size.Y / 2) and Hum.FloorMaterial == Enum.Material.Air and Root.Velocity.Y >= 0 then
				Root.Anchored = true holding = true HA:Play() ledgeavailable = false
			end
		end
	end
	
	function climb()
		local Vele = Instance.new("BodyVelocity",Root)
		Root.Anchored = false Vele.MaxForce = Vector3.new(1,1,1) * math.huge Vele.Velocity = Root.CFrame.LookVector * 10 + Vector3.new(0,30,0)
		HA:Stop() CA:Play()
		game.Debris:AddItem(Vele,.15) holding = false
		wait(.75)
		ledgeavailable = true
	end
	
	UIS.InputBegan:Connect(function(Key,Chat)
		if not holding then return end
		if Key.KeyCode == Enum.KeyCode.Space and not Chat then
			climb()
		end
	end)
	
	if TouchGui then
		TouchGui:WaitForChild("TouchControlFrame"):WaitForChild("JumpButton").MouseButton1Click:Connect(function()
			if not holding then return end
			climb()
		end)
	end
end

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.