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

Big question ! , Why does the StringValue show nothing ?!

game.Players.PlayerAdded:Connect(function(players)
	local folder = Instance.new("Folder",players)
	folder.Name = "leaderstats"
	local Points = Instance.new("IntValue",folder)
	Points.Value = 0 
	Points.Name = "Points"
	local Rank = Instance.new("StringValue",folder)
	Rank.Name = "Amateur"
	while true do 
		wait(5)
		Points.Value = Points.Value + 1
	end
	if Points.Value > 9 then
		Rank.Value = "Better"
	end 
end)

Im currently trying to make a a rank system EX : 10 points you can get the "Better" rank , but instead of working . When the points hit 10 , nothing happens , the rank is still at Amateur . I put this script in ServerScriptStorage , the outputs shows no errors , Any help would be greatful !

2 answers

✓ Accepted answer

if only checks if points is bigger than 9 once solution: after the player added event add both loops as loops inside connects don't really play nice... put the if statement inside the loop and also the part where it adds 1 every 5 seconds

--player added part

while true do
	wait(5)
	Points.Value = Points.Value + 1
	if Points.Value > 9 then
		Rank.Value = "Better"
	end
end

For your case specifically, do..

while wait() do
	if Points.Value > 9 then
        	Rank.Value = "Better"
	end
end

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