New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Making a random cash box drop?

Asked by
Duhled 0
10 days ago
Edited 9 days ago

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)
0
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. Duhled 0 — 9d

1 answer

Log in to vote
0
Answered by 8 days ago

You got it all setup, expect that you didn't use the function

game.Players:GetPlayerFromCharacter(part.Parent)

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

Ad

Answer this question