Energy = Instance.new('NumberValue', Objects) Energy.Name = 'Energy' Energy.Value = 100 Energy.Changed:connect(function(val) EnergyBar.Size = UDim2.new(val / MaxEnergy.Value,0,0,1) if val > MaxEnergy.Value then val = MaxEnergy.Value end end)
Plain and simple, the function isn't triggered when Energy is changed.