Animations not loading after all them finish

  1. Trying to make the animations play over once they are all over

  2. Animatons load fine but after it finishes all the animations, when I click again it doesn’t fire

  3. tried reworking the scripts but no results

-- 
local CAS = game:GetService("ContextActionService")
-----------------------------------------------
local PunchCount = 0
local Debouncey = false


local FightAnimation = function()
	
	if Debouncey then return end
	
	if PunchCount > 3 then
		PunchCount = 0
		--------------
	else
		PunchCount = PunchCount + 1
                print(PunchCount)
	end
		
local Character = game.Players.LocalPlayer.Characterocal Character = game.Players.LocalPlayer.Character
	
	Debouncey = true
	----------------------------------------------------
	local RightPunch = game.ReplicatedStorage.RightPunch
	local LeftPunch = game.ReplicatedStorage.LeftPunch
	local Kick = game.ReplicatedStorage.KickAnimation
	---------------------------------------------------
	local RightPunchAnimation = Character.Humanoid.Animator:LoadAnimation(RightPunch)
	local LeftPunchAnimation =  Character.Humanoid.Animator:LoadAnimation(LeftPunch)
	local KickAnimation =       Character.Humanoid.Animator:LoadAnimation(Kick)
	--------------------------------------------------------------------------------


	
	if PunchCount == 1 then
		RightPunchAnimation:Play()
		task.wait(.4)
		Debouncey = false
	elseif PunchCount == 2 then
		LeftPunchAnimation:Play()
		task.wait(.4)
		Debouncey = false
	elseif PunchCount == 3 then
		KickAnimation:Play()
		task.wait(.4)
		Debouncey = false
	end
	
	
end


CAS:BindAction("FightAnimation",FightAnimation,false,Enum.UserInputType.MouseButton1)
1 Like

I noticed this part, can you explain this and I might be able to help

local Character = game.Players.LocalPlayer.Characterocal Character = game.Players.LocalPlayer.Character

that’s not in the script I just typed it in wrong in the post thing

maybe try using UIS instead of CAS

Alright I’ll try it out, right now

is the animation created by you and you upload as your work?
also you need to make the game publish and make it that you made it…

Yeh it is I published, but privated and I made it yes

if it worked loading it the first time it should also the second time, so it must be something with the function run

make the animation by you and the game so

if PunchCount > 3 then

You’re adding 1 to your punch count even when your count is 3. Because of this, the debounce is set to true and never meets any condition to become false again.
Try adding to the count before checking the number.

alrigh ill try that and see if it works

I did that and it still didn’t work idk what the heck is the problem


	if PunchCount >= 3 then
		PunchCount = 0
	else
		PunchCount += 1
	end
	
	print(PunchCount)
	local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()

try this? I’m not entirely sure what the issue could be aside from the punchcount portion

that still didn’t work, I seriously don’t know what the problem is lol

I might have to write the entire script I think

Add some prints throughout the script to see where it stops printing

Try changing the lines that say PunchCount = 0 to PunchCount = 1. The debounce only gets set to false if PunchCount is 1-3

Actually this is true, in the portion I sent you could change the 0 to a 1

Lol bro solved my problem in like 1 minute thanks

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