It’s because the size is being set incorrectly, you’ll want to have the scale factor as I’ve brought up. Multiply that division that you’ve done in the change variable by the x size.
So something like this:
local change = (exp.Value / expNeeded) * X.Size.Scale
X being the UI bar element, make sure you set the correct path.
No no, it’s perfectly fine that you’re confused. That’s how you learn! UIScale is a property within the size property. To find out whether you’re using the scale, it’s determined by the 1 numbers of the XY scale:
Scale: {1,0,1,0} Not Scale (Offset): {0,50,0,50}
So if you want to change your bar size by scale, you can just get the bar max size by doing: bar.Size.X.Scale or just by getting the value of the max size, which is what I do.
From there, your code would look along the lines of:
local change = exp.Value / expNeeded * bar.X.Size.Scale
Ok, I tried a few things and most of them didnt work, i made a varible and gave it the value of the max size that i want it and tried to add it too the local change but the entire script broke and the gui would move, i also really am confused about the plugin as well as scale like im not sure what to set it as
local bar = script.Parent.EXPBar
local text = script.Parent.EXPLabel
local plr = game.Players.LocalPlayer
local level = plr.LevelInfo.Level
local exp = plr.LevelInfo.Experience
local expNeeded =math.floor(7 * 1.3 ^ level.Value)
local function updateBar()
expNeeded = math.floor(7 * 1.3 ^ level.Value)
text.Text = exp.Value.." / "..expNeeded
print(bar.Size.X.Scale)
local change = (exp.Value / expNeeded)
bar:TweenSize(UDim2.new(change,0, .12, 0), "In", "Linear", 0.2)
end
updateBar()
exp.Changed:Connect(updateBar)
level.Changed:Connect(updateBar)
Ah ok, you are in offset which is fine but try converting to scale when you can. So, for the change, set the variable equal to: (exp.Value / expNeeded) * 331
For the Tween, for the first parameter, do UDim2.fromOffset(change, 12)
I’m so glad it worked and it was a pleasure helping , when you switch to scale in the future, multiply by the first number you see for the X, and for the tween, instead of fromOffset, do fromScale.