EXP system gui not working

Ok, Whatever this did made it a bit better just doesnt fill up the entire bar

  1. updateBar() Calls the function named “updateBar” and runs the lines of code within said function. Useful for repeated code.
  2. exp.Changed:Connect(updateBar) Calls the updateBar function whenever the exp is changed.
  3. level.Changed:Connect(updateBar) Does the same thing.

I simply simplified your code.

Honestly, I think you would need to check the bar’s properties. Because size, position and anchor points could alter the bar. I would also check to see if there are objects adjusting padding and positions such as a “UIPadding” object and things of that nature.

At this point I think you have all the tools and options that could solve this issue. If not keep at. Small problems like this is common with UIs.

Its working exactly how i need it to work, its just not going past a certain point which I have no idea why :confused:

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.

X.Size.Scale? What does scale do? or what does it mean?

The scale is a size property and is recommended to be used so that the size is the same on all devices

Hmmm ok sir, would i change scale to something?

Scale is a value between 0 and 1, that’s up to you to decide on.

Ok I think ik where your getting at. Not sure if I’m doing this right but it didnt work lol

	local Size = Instance.new("UIScale", bar)
	local change = bar.Size - UDim2.new(exp.Value / expNeeded)```

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

For easy conversions from offset to scale, I highly suggest using this plugin: [Plugin] AutoScale Lite for GUIs - Scale your UI

Not exactly sure how to use the plugin but I’m tryna to do what you said.

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 :confounded:

For the plugin, go to the size area and press Scale and the code should work. If it doesn’t work, please show me a clip of what’s going on.

https://gyazo.com/6fa6a64ac09450706b7b4f872b9d5828

Its clearly limiting itself to a certain point and wont go over.

Ah I see the issue, what’s the size of the bar? Also show me your current code for it.

Size of the bar is 0

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)

No no, what’s the size of the bar when it’s at the end of the level of what you want, not the error.

OH the size is: 0, 331,0, 12

random stuff right here so i can post this