MouseLeave event keeps triggering twice even though I added debounce, the event triggers at the same time

self.Connections[#self.Connections + 1] = self.Object.MouseLeave:Connect(function()
	print("time:", tick() - self.lastcalled, "|", self.zID)
	self.zID = self.zID  + 1
	self.lastcalled = tick()
	
	if self.Rotating then
		if self.Viewport and not self.Selected and self:Check() then
			self.Rotating = false
			self._modules.Viewports:StopRotation(self.Viewport)
		end
	end
end)

image

As you can see, the print got printed twice and share the same ID even though it shouldn’t
Can someone help me improve or fix it?

Code Review is for improving code that works, not for support on issues with your code. Please remember to review category guidelines for more information on what topics fit a category.

I’ve moved this to Scripting Support.

1 Like

Fixed my own problem, had to fix some stuff