I have a script, It has 1 while loop so every __ seconds it will give mana. The number of seconds depend on the player's level. I want the player's level to go up every minute they play the game. Please help!
game:GetService("Players").PlayerAdded:connect(function(plyr)
local stats = Instance.new("IntValue", plyr)
stats.Name = "leaderstats"
local lvl = Instance.new("IntValue", stats)
lvl.Name = "Level"
lvl.Value = 1
local mana = Instance.new("IntValue", stats)
mana.Name = "Mana"
mana.Value = 0
while wait(1/lvl.Value) do
mana.Value = mana.Value+1
end
end)

2 comments
Use coroutines. http://wiki.roblox.com/index.php?title=Coroutine It's almost like a separate script running in one.
Coroutines are not the optimal solution here, although they will technically work.