Tool animation playing for everyone

I been struggling to fix this bug where, when someone equips a tool with an animation, it sometimes plays the animation for everyone.

Code:

local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local EquippedValue = tool.EquipValue

local Bound = 1

local IdleAnim = character.Humanoid:LoadAnimation(script.IdleAnim)
local DrinkAnim = character.Humanoid:LoadAnimation(script.EatAnim)

local OpenSound = tool.Handle.OpenSound
local DrinkSound = tool.Handle.DrinkSound

tool.Equipped:Connect(function()
	EquippedValue.Value = true
	OpenSound:Play()
	IdleAnim:Play()
end)

tool.Unequipped:Connect(function()
	EquippedValue.Value = false
	Bound = 1
	DrinkAnim:Stop()
	DrinkSound:Stop()
	OpenSound:Stop()
	IdleAnim:Stop()
end)

tool.Activated:Connect(function()
	if EquippedValue.Value == true and character.Attacking.Value == false and character.Dead.Value == false and character.Finished.Value == false and character.Finisher.Value == false and Bound == 1 then
		Bound = 2
		DrinkAnim:Play()
		DrinkSound:Play()
		script.Amount.Value = script.Amount.Value + 1
		task.wait(2)
		Bound = 1
	end
end)

while task.wait() do
	if script.Amount.Value == script.Limit.Value then
		Bound = 0
		task.wait(1.5)

		DrinkAnim:Stop()
		DrinkSound:Stop()
		OpenSound:Stop()
		IdleAnim:Stop()
		tool:Destroy()
	end
end

i think this cause by cloning the tool, because sometimes the cloned tool destroy itself.

Why and when are you cloning the tool? I’m guessing when it’s cloned the script may start running before its parented to the character which might give an error when trying to find the local player

It’s replication

I don’t think cloning tool causes this (would be very strange if it was connected to animation replication for very strange reason)

Humanoid:LoadAnimation() inside a LocalScript, the animation should only be visible to the local player. However, if the Animation objects (like IdleAnim, EatAnim) are stored inside the Tool, which is replicated across all clients, then the animation might appear globally, even though it’s triggered locally.

yeah the animation is inside the local script, but where i should place the animationsid then?

by activating a proximityprompt

No, LoadAnimation in a LocalScript will always replicate regardless of whether the Animation instance used is actually replicated to other clients. You can test this yourself by making a LocalScript which creates an Animation and plays it, then setting up a 2-player local server.