Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Daily Reward Script Is Only Working For The First 3 People That Join The Game?

Asked by 4 years ago

My Daily Reward Script Is Only Working For The First 3 People That Join The Game, It Consists Of A Touch Part That Gives A Small Popup Gui On Your Screen. Another Problem It Has Is That It Gives You 2000$ Instead Of 1000$, Though I Have Adapted To This Change.

currency = "Money"  
amnt = 1000         
debounce = false        

    function onTouch(hit)
        if hit.Parent:findFirstChild("Humanoid") ~= nil and debounce == false then
            if game.Players:findFirstChild(hit.Parent.Name) ~= nil then
            ThisPlayer = game.Players:findFirstChild(hit.Parent.Name)
            ThisPlayer.leaderstats:findFirstChild(currency).Value = ThisPlayer.leaderstats:findFirstChild(currency).Value + amnt
            script.Parent.Transparency = 1
            script.Parent.CanCollide = false
            debounce = true
            wait(86400)     -- Respawn time for the cash giver
            script.Parent.Transparency = 0
            script.Parent.CanCollide = true
            debounce = false
            end
        end
    end


script.Parent.Touched:connect(onTouch)

1 answer

Log in to vote
1
Answered by 4 years ago

Just do a PlayerAdded event:


game.Players.PlayerAdded:Connect(function(playerName) -- blah blah blah end)
0
I Already Tried That And It Was Very Buggy ricelicker 52 — 3y
Ad

Answer this question