Changing the size of the gui

I am making an xp system in my game, but when the script I have resizes it, it makes the bar taller, I dont know why.

local bar = script.Parent
local text = bar.XpAmount

local player = game:GetService("Players").LocalPlayer
local level = player.LevelsInfo.Level
local exp = player.LevelsInfo.Experience
local expneeded = 50*level.Value

text.Text = exp.Value.."/"..expneeded

local change = exp.Value / expneeded
bar:TweenSize(UDim2.new(change, 0, 1, 0), "In", "Linear", 0.5)
while wait(1) do
exp.Changed:Connect(function(newXp)
	expneeded = 50*level.Value
	text.Text = exp.Value.."/"..expneeded
	
	local change = exp.Value / expneeded
	bar:TweenSize(UDim2.new(change, 0, 0, 0), "In", "Linear", 0.5)
	end)
	end

it makes it look like this:
image

It seems like you changed the Y size to 1. This causes it to be as tall as the frame it is in. You should make the Y value the size as tall as the black bar. (i.e. the Y size would be 0.05 if you wanted it to be small.)

Thankyou! Idk how i didnt realize that

1 Like