i have the basic fundementals of it down but how do i make it if the max value of the energy changes the size of the gui changes?
heres the script i got so far
local bar = script.Parent
local energy = script.Parent.Energy
local maxEnergy = script.Parent.MaxEnergy
local text = script.Parent.Parent.TextLabel
text.Text = energy.Value.."/"..maxEnergy.Value
energy.changed:connect(function()
bar.Size = UDim2.new(energy.Value/100,0,1,0)
if energy.Value >= 100 then
energy.Value = 100
elseif energy.Value < 1 then
energy.Value = 0
end
end)
