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

Why is my data getting sent to random player?

Asked by 3 years ago

So I can't use local scripts with proximity prompt and I saw that I could get player through server script but now it gives it to a random player and its getting really annoying. (I'm not very good at scripting) here's code :

game.Players.PlayerAdded:Connect(function(player)
    local debounce = false

    script.Parent.Triggered:Connect(function()
        if debounce == false then
            debounce = true
            script.Parent.ActionText = ("Steal [DISABLED]")
            player.leaderstats.Cash.Value += math.random(100, 1000)
            script.Parent.Sound:Play()
            wait(10)
            script.Parent.Sound:Stop()
            debounce = false
            script.Parent.ActionText = ("Steal [ACTIVE]")
        end
    end)
end)

1 answer

Log in to vote
0
Answered by 3 years ago

delete PlayerAdded function and type player inside triggered function brackets that will know what players is using ProximityPrompt, because when you use PlayerAdded and somebody will join after you it will take him and it will be giving cash to him

0
tysm FrontalDev 17 — 3y
Ad

Answer this question