for i, v in ipairs(punches) do
local anim = player.Character.Humanoid:LoadAnimation(punches[i])
anim:Play()
anim.Stopped:Wait()
end
-- or
for i = 1,#punches do
local anim = player.Character.Humanoid:LoadAnimation(punches[i])
anim:Play()
anim.Stopped:Wait()
end
New code:
local AnimPlayed = 0
local Debounce = false
local punches = {...}
tool.Activated:Connect(function()
if not Debounce then
Debounce = true
if AnimPlayed < #punches then
AnimPlayed += 1
local anim = player.Character.Humanoid:LoadAnimation(punches[AnimPlayed])
anim:Play()
anim.Stopped:Wait()
Debounce = false
elseif AnimPlayed >= #punches then
AnimPlayed = 1
local anim = player.Character.Humanoid:LoadAnimation(punches[AnimPlayed])
anim:Play()
anim.Stopped:Wait()
Debounce = false
end
end
end)
I did something like this a while ago. What I did was I made it so every time you activate the tool a number value goes up by 1 and ends at the number of animations you have and then goes back down to 1. When activating the tool it checks an if statement. For example if number == 1 then it plays the first animation and if number == 2 it plays the second animation and so on. I don’t know if this will work but you can try something like that. Good luck! I hope you fix your problem and I hope this helps in some way. Sorry if this doesn’t work.
That is extremely similar to what I did but I think how I had it done was in a less complicated way. But I’m not sure why both ways wouldn’t work just the same.
Did your script work for you?