So I am trying to make my own tycoon from scratch and I only have to make the collector where you touch it and get the money, and at first it was working fine, but something happened (Which I'm not sure what happened) and it gives the player double the money every time they touch it. Here is an example of the code
local Button = script.Parent
local CashToCollect = script.Parent.Parent.Parent.PartCollector.CashToCollect
local debounce = false
local timer = 2
Button.Touched:Connect(function(hit)
if debounce == false then
debounce = true
if hit.Parent:FindFirstChild("Humanoid") then
if hit.Parent.Name == script.Parent.Parent.Parent.OwnerDoor.Owner.Value then
local Player = game.Players:FindFirstChild(script.Parent.Parent.Parent.OwnerDoor.Owner.Value)
Player.leaderstats.Cash.Value = Player.leaderstats.Cash.Value + CashToCollect.Value
CashToCollect.Value = 0
end
end
wait(timer)
debounce = false
end
end)
` If someone could help it would be greatly appreciated.

3 comments
Try adding a print statement after line 10 and see if it prints 2 times. If it does then I can further help then.
*more than once
I put print(hit) after line 10 and at first I thought it would print both legs, but it only prints right leg but it stills double the money received