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

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

Asked by 8 years ago

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

Log in to vote
1
Answered by 8 years ago

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

Ad

Answer this question