I'm working on a tycoon machine, and I discovered that the part that will give money once touched does not destroy the first part it detects once touched. In other words, the first part is not destroyed, but once it is gone, the rest are destroyed. Here is the script:
local debounce = false
script.Parent.Touched:connect(function(hit)
if debounce == true then return end
if debounce == false then
debounce = true
local tycoonowner = script.Parent.Parent.Parent.TycoonOwner
local player = game.Players:GetChildren()
for i = 1, #player do
if player[i].Name == tycoonowner.Value then
player[i].leaderstats.Money.Value = player[i].leaderstats.Money.Value + script.MoneyAwarded.Value
hit:Destroy()
end
if player[i].Name ~= tycoonowner.Value then
end
end
wait(1)
debounce = false
end
end)

1 comment
Thanks. It worked great.