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

How to award players leaderstats points for being in a group?

This still award players who are not in the group and who are in the group, help? Script:

game.Players.PlayerAdded:connect(function(player)
if player:IsInGroup(1161143) then
	while wait(30) do 
    for _, player in ipairs(game.Players:GetPlayers()) do
        if player:FindFirstChild("leaderstats") then
            player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
        end
    end
	end

end
end)

Thanks.

1 answer

✓ Accepted answer

So the way your current script is makes it give it to all players. You have it so on line 4-8 it gives all players the award. To fix this you simple take out your for loop. Final code should look like this:

game.Players.PlayerAdded:connect(function(player)
	if player:IsInGroup(1161143) then
  	  while wait(30) do 
   		 if player:FindFirstChild("leaderstats") then
           		 player.leaderstats.Points.Value = player.leaderstats.Points.Value + 1
	        end
   	   end
	end
end)

Now it will give the individual player an award if they are in the group

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