Remote event triggering unexpectedly

I have a localscript inside a tool here,

local RS = game:GetService('ReplicatedStorage')
local remoteEvent = RS:WaitForChild("SBaneTest")
debounce = false

script.Parent.Activated:Connect(function()
	if script.Parent.Edible.Value == true then
		debounce = true
		wait(3)
		print("h")
		remoteEvent:FireServer()

	end
end)
remoteEvent:FireServer()

And whenever I enable this script the remote event will fire without me activating the tool, but when i disable the script everything works, why is that?

Because you put

remoteEvent:FireServer()

Twice which is outside of the activated event,

.

2 Likes

Oh, i didn’t realize that, silly me

Adding on to what @SilentSuprion basically every time you enable a script after it was disable it’ll go through all the lines of code again

2 Likes