EXP system gui not working

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

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)

This should work hopefully lol

dude i love you so much right now it worked thank you so much

1 Like

I’m so glad it worked and it was a pleasure helping :relaxed:, 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.

Happy developing!

Thank you! Really took me a long time I will praise you for the rest of my lifetime. Your a god to me now

1 Like