So stm is the bar im tweening, stmvalue is a number value for stamina stmvalue2 is the maxstamina also a number value, I have tried multiple ways of doing this ive had the number value go up but the bar not go up with it I do not know if its a tweening error were its being told to tween so much or not but this is the final product I came up with this and it dose not work at all I need the bar to always update based on the number for stamina. after so many problems and no errors i gave up so I hope someone can help heres the code.
local stm = script.Parent
local stmvalue = script.Parent.Stamina
local stmvalue2 = script.Parent.MaxStamina.Value
local rs = game:GetService(“RunService”)
stmvalue.Changed:Connect(function(value)
print(“changed”)
stm:TweenSize(UDim2.new(value/stmvalue2 * .236,0,0.02,1),“In”,“Linear”,1)
end)
– regen
rs.RendereStepped:connect(function()
wait()
print(“running”)
if stmvalue.Value > 100 then
print(“1”)
stmvalue.Value = stmvalue.Value + 20
elseif stmvalue.Value > 100 then
print(“2”)
stmvalue.Value = 100
elseif stmvalue.Value == 100 then
wait()
print(“3”)
end
end)
– auto update for regen
rs.RenderStepped:connect(function()
wait()
stm:TweenSize(UDim2.new(stmvalue.Value/stmvalue2 * .236,0,0.02,1),“In”,“Linear”,1)
end)