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 4 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 :

01game.Players.PlayerAdded:Connect(function(player)
02    local debounce = false
03 
04    script.Parent.Triggered:Connect(function()
05        if debounce == false then
06            debounce = true
07            script.Parent.ActionText = ("Steal [DISABLED]")
08            player.leaderstats.Cash.Value += math.random(100, 1000)
09            script.Parent.Sound:Play()
10            wait(10)
11            script.Parent.Sound:Stop()
12            debounce = false
13            script.Parent.ActionText = ("Steal [ACTIVE]")
14        end
15    end)
16end)

1 answer

Log in to vote
0
Answered by 4 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 — 4y
Ad

Answer this question