P = script.Parent.Parent.Parent.Parent P.leaderstats.EXP.Changed:connect(function() if P.leaderstats.EXP > (P.leaderstats.MaxEXP) then P.leaderstats.Level.Value = P.leaderstats.LastLevel.Value + 1 P.leaderstats.EXP.Value = 0 P.leaderstats.MaxEXP.Value = P.leaderstats.Level.Value * 59 local PositionX = script.Parent.Position.X.Offset local initX = script.Parent.Size.X.Offset while true do wait() local EXP = script.Parent.Parent.Parent.Parent.Parent.leaderstats.EXP.Value local EXPMax = script.Parent.Parent.Parent.Parent.Parent.leaderstats.Level.Value * 59 local Pie = (EXP / EXPMax) --Missed Scale --script.Parent.Size = UDim2.new( 0, initX*Pie, 0, 30) script.Parent:TweenSize(UDim2.new(0, initX*Pie, 0, 30),"Out","Sine",0.25) end
The script isn't working because the TweenSize command only occurs if EXP > MaxEXP (at which point EXP is reset anyway). After the first level is achieved, the script will appear to start working.
However, you are starting a new infinite loop every time EXP > MaxEXP. Instead, either take the while loop out of the "Changed" function (ex add an 'end' statement on lines 8 and 9), or else move the contents of the while loop into the function (but don't use a loop).
This may be why it is not working but I carnet test it.
This may result in a float e.g 1.3442:-
local Pie = (EXP / EXPMax)
The offset value must be in an Integer Click Here