Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Tycoon Dropper's Money Gives Extra Money?!

I Maked Tycoon And Placed Conveyor But When Part Deletes It Gives Extra Money! Here's Script:

script.Parent.IDK.Touched:connect(function(hit) if hit.Name == "Money" then local plr = game.Players.LocalPlayer plr.leaderstats.Money.Value = plr.leaderstats.Money.Value + script.Parent.WOW.Value hit:Destroy() end end)

Please Fix It! Thanks For Looking!

1 answer

✓ Accepted answer

You are just missing a debounce. Sometimes the Touched event can fire multiple times for a single part.

local debounced
script.Parent.IDK.Touched:connect(function(hit)
    if not debounced and hit.Name == "Money" then
        debounced = true
        local plr = game.Players.LocalPlayer
        plr.leaderstats.Money.Value = 
            plr.leaderstats.Money.Value + script.Parent.WOW.Value
        hit:Destroy()
        debounced = false
    end
end)

1 comment

0

THANK YOU!

This discussion is preserved as it was. New answers, comments, and votes are closed.