I am making a sandbox tycoon and i have a money collector that adds money directly to the players cash, but it only works on the first one that touches it. Please help!
function onTouched(hit)
if hit.Name == "Cash" then
game:GetService("ReplicatedStorage").Owner1.OnServerEvent:connect(function(player)
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + hit.Value.Value --Gives money based on value in money
hit:remove()
end)
end
end
script.Parent.Touched:Connect(onTouched)
Also, for some reason it adds a touch interest in the part that has the script in it.

3 comments
Bump
Bump
Bump