Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is my data getting sent to random player?

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

✓ Accepted answer

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

1 comment

0

tysm

This discussion is preserved as it was. New answers, comments, and votes are closed.