game.Players.PlayerAdded:Connect(function(plr) local leaderstats = Instance.new('Folder',plr) leaderstats.Name = 'leaderstats' local rank = Instance.new('StringValue',leaderstats) rank.Name = 'Rank' rank.Value = 'Private' local xp = Instance.new('IntValue',leaderstats) xp.Name = 'XP' xp.Value = 0 while wait(3) do xp.Value = xp.Value + 1 end if (xp.Value >= 10) then rank.Value = 'Corporal' end end)
Pretty easy answer. Change everything underneath xp.Value = 0
to (explanation underneath script):
while wait(3) do xp.Value = xp.Value + 1 -- Random note but Lua seriously needs to add += or something like that if xp.Value >= 10 then rank.Value = "Corporal" end end
What we do here is check every time the loop runs if xp.Value
is greater than or equal to 10. If it is, we rank up the player. We then continue to increase the player's xp.