UIGridLayout Fit

I’m novice in gui fit, i use a Gui Rescaler Plugin, but no one plugin help me in this, I have a xp bar system that use’s UIGridLayout and in ever device the UI change the size and in my system the ui grid is set to be 50 pixels of height (Y) that is the size of the gui in studio, but in ever device the ui change the size, and ui grid continues to set the bar 50 pixels of height (Y), i’m gonna take a screenshots, and show my script (idk if are needed)

local xp = Player:WaitForChild(“Xp”)
local xpRequired = Player:WaitForChild(“XpRequired”)
local level = Player:WaitForChild(“leaderstats”):WaitForChild(“Level”)
function update()
local y = script.Parent.Size.Y
print(y)
local p = (xp.Value / xpRequired.Value) * 600
PlayerGui.LevelGui.Frame.UIGridLayout.CellSize = UDim2.new(0, p, 0,50)
end
xp.Changed:Connect(update)



I believe that you will need to use scale for the cellsize(and cell padding if you are changing that ever), instead of offset. You will have to play around and with the scale until you get your desired effect.

2 Likes

thanks for your guidance, i make this and works

local p = (xp.Value / xpRequired.Value) * script.Parent.AbsoluteSize.X
PlayerGui.LevelGui.Frame.UIGridLayout.CellSize = UDim2.new(0, p,0,script.Parent.AbsoluteSize.Y)