Why does this event fire multiple times?

I’m trying to make a ability where if you hold down the mouse you can wait to release the ability, but for some reason the remote event fires a couple of times even though I only click once.

local Tool = script.Parent
wait()
local Anim = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
local Hold = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Hold)
local Idle = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Idle)

local mouse = game.Players.LocalPlayer:GetMouse()
local UIS = game:GetService("UserInputService")
local cd = false
Tool.Activated:Connect(function()
	if cd == true then return end
	cd = true
	coroutine.wrap(function()
		wait(5)
		cd = false
	end)()
	script.Add:FireServer("add")
	Hold:Play()
	
	
	
	Hold:GetMarkerReachedSignal("Hold"):Connect(function(paramString)
		Idle:Play()
		
		if not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1) then
			Idle:Stop()
			print("FIRED")
			script.RemoteEvent:FireServer(mouse.Hit.p)
		else
			repeat wait() until not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
			Idle:Stop()
			print("FIRED")
			script.RemoteEvent:FireServer(mouse.Hit.p)
		end
			
	end)

end)

Watch Desktop 2024.03.22 - 22.01.09.10 | Streamable video of the issue

repeat wait() until not UIS:IsMouseButtonPressed(Enum.UserInputType.MouseButton1)
Idle:Stop()
print(“FIRED”)
script.RemoteEvent:FireServer(mouse.Hit.p)

This part is the one that is firing all the time right???(Can u add more description as i didnt see any errors.

both of the sections cause the error. Thats there to detect if their holding it and when they release that one goes instead if they did hold it

bruh,It is very obvious.You keep playing the animation,and once it is playing,That signal will always happen,causing it to fire multiple times

Is this a local script???

If yes,you have to add a humanoid check