Is there a better way to play animations?

Is there a better way of playing animations then what I have used below?

Animating tool for the player:

Inside of Tool is a Script with an Animation parented to it:

Script:

local Tool = script.Parent
local Handle = Tool.Handle

local ToolAttackAnimation = script.ToolAttackAnimation

local Debounce = false

Tool.Activated:Connect(function()
	if not Debounce then
		Debounce = true
		
		local Humanoid = Tool.Parent:WaitForChild("Humanoid")
		local AnimationTrack = Humanoid:LoadAnimation(ToolAttackAnimation)
		
		AnimationTrack:Play()
		
		wait(1)
		
		Debounce = false
	end
end)
2 Likes

That looks fine but make sure the client is handling animations.

1 Like

Ok cool. So everyone on the server will still see this animation being played?

1 Like

Yes.

This text will be blurred

You should only be loading the animation once. So create the variable outside of event listener’s scope, and check if it does not exist before loading it.