Quick Premium Benefit not working

while wait(1) do
	for _, player in next, game.Players:GetChildren() do
		if player.MembershipType == Enum.MembershipType.Premium then
			player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 5

In a server script. There is nothing else in the script. Premium members do not receive 5 coins per second. I understand there may be a more efficient way of doing this, but right now I just need it to work.


for _, Plr in pairs(game.Players:GetPlayers()) do 
    local leaderstats = Plr:WaitForChild("leaderstats")
    local Coins = leaderstats:WaitForChild("Coins")

    if Plr.MembershipType == Enum.MembershipType.Premium then
        Coins.Value += 5

Use pairs instead, and you might wanna consider waiting a bit longer so that the leaderstats & Coins are able to be properly Parented inside your Player Object

Are you sure the leaderstats folder is visible server sided?

I’m not sure if ‘leaderstats’ would be created on the client to prevent exploiters…? (Also leaderboard won’t work) @Jackscarlett I took your logic for WaitForChild() and the code now works. Thanks!