hello everyone, I created a script for the animation of the blow I have a problem, namely, when I click on the blows, you can see for yourself on the video help fix my script
local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://14717519545"
local track
tool.Activated:Connect(function()
wait() -- DELAY TIME 2 SECONDS YOU CAN CHANGE IT
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
track:Play()
end)
tool.Unequipped:Connect(function()
if track then
track:Stop()
end
end)
first of all from the script you have provide above
tool.Activated:Connect(function()
wait() -- DELAY TIME 2 SECONDS YOU CAN CHANGE IT
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
track:Play()
end)
the above script won’t wait just beacuse you use wait inside the function
because everytime the remote event gets fired the function will called and do it task
for this use debounce
like
local debounce=false
tool.Activated:Connect(function()
if debounce then
return
end
debounce=true
track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
track.Priority = Enum.AnimationPriority.Action
track.Looped = false
track:Play()
wait(5)
debounce=false
end)
nvm it will wait for few sec before the animation plays