If The Animation Complete They Get Coins

Im Working On A Coin Eating Game (Dont Question)

When They Eat The Coin They Get Coins But There Is A Animation So I Want It When The Animation Finishes They Get The Coins And If The Animation Doesn’t Finish They Don’t Get Any Coins.

But If The Player Spams The Click They Get Spammed With Coins.

local tool = script.Parent
local eatinganimation = tool.EatingAnimation

local eatinganimationFinished = false

tool.Activated:Connect(function()
	local Character = tool.Parent
	local Humanoid = Character.Humanoid
	local AnimationTrack = Humanoid:LoadAnimation(eatinganimation)
	AnimationTrack:Play()
	
	wait(1)
	
	eatinganimationFinished = true
	
	if eatinganimationFinished == true then
		
		print("test")
		
	end
end)

You can simply add a debounce to the tool:

local debounce = false

tool.Activated:Connect(function()
    if debounce == true then return end -- Checking if the player has already used the tool
    debounce = true -- They used the tool, so we set this value to true
    -- code
    debounce = false -- Resetting the tool
end)