Trying to make it where boxes drop X amount of times a minute, and give you X amount when ran into. This is the script inside the box that drops now, but so far can't get it to give me cash on contact. Already have a working random drop script. More details: Trying to make it 1.Check that its a player that touches it, 2.Make it award X amount on touch 3.Self destruct after touched and cash has been increased.
deb = false script.Parent.Touched:connect(function(part) if part.Parent:FindFirstChild("Humanoid") and game.Players:FindFirstChild(part.Parent.Name) then if deb == false then deb = true local plr = game.ServerStorage.PlayerMoney:FindFirstChild(part.Parent.Name) plr.Value = plr.Value + script.Parent.Parent.Amount.Value wait(script.Parent.Parent.TimeToWait.Value) deb = false end end end)
You got it all setup, expect that you didn't use the function
Then, just proceed normally as you would giving the player the amount of bucks he is supposed to get, and then just self destruct itself when it's all done