I’m trying to make a tycoon and I need a collector for it, but my script almost works, it doesn’t give the player cash when a drop is put in to the collector.
Script:
local players = game:GetService("Players")
local collecter = script.Parent
local basepart = collecter.BasePart
basepart.Touched:Connect(function(hit)
if hit.Name == "Drop" then
for _, player in ipairs(players:GetPlayers()) do
player.leaderstats.Cash.Value += hit.CashValue.Value
end
hit:Destroy()
end
end)
basepart.Touched:Connect(function(hit)
print(“basepart”)
if hit.Name == “Drop” then
print(“drop”)
for _, player in ipairs(players:GetPlayers()) do
print(player)
player.leaderstats.Cash.Value += hit.CashValue.Value
end
hit:Destroy()
end
end)