What I’m trying to do is every second the stat would increase by 2 until it reaches it’s max point. I’ve tried this but it wouldn’t add points every second.
My script:
local stamina = 320
local maxStamina = 320
local value = game.ServerStorage.mate
repeat wait()
wait(1)
print("test")
stamina = stamina + 2
updateStamina() -- this function updates the UI
until value.Value == true
repeat
local dt = wait(1)
stamina = stamina < maxStamina and stamina + 2 or stamina -- in line logic operation
until stamina >= maxStamina or value.Value
Wait, sorry. Is the problem in presenting the data?
does updateStamina() do is job?
That script worked! Except it doesn’t update the UI right away as you receive the points.
Here is updateStamina() function.
local updateStamina = function()
textlabfor.Text = stamina
staminaBar:TweenSize(UDim2.new(0.113,0,stamina/maxStamina-0.28,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,.5,true)
end