I’ve been trying to make a value regenerate itself back to its original number whenever its number is reduced. However, the script I have made, located inside the NumberValue instance, simply doesn’t do anything. No output errors, nothing.
local stamina = script.Parent
local number = stamina.Value
while true do
wait(0.05)
while stamina.Value < number do
stamina.Value = stamina.Value + 2
wait(0.05)
end
end
I wrote this after taking notes from the script Roblox uses to regenerate health from avatars. I would like to know what I’m doing wrong and how I can make it work.