Hello!
I’m currently working on handling my game’s inventory however I am experiencing an issue where if the user sharply changes their screen size, the script I made to adjust the cell size doesn’t work properly. Not sure how else to explain it but here’s a video:
The goal is to have an unlimited amount of columns but only 5 rows but the cells should be perfectly square.
Script:
local players = game:GetService('Players')
local replicatedStorage = game:GetService('ReplicatedStorage')
local player = players.LocalPlayer
local playerData = player:WaitForChild('PlayerData')
local inventory = playerData:WaitForChild('Inventory')
local inventoryItems = inventory:WaitForChild('Items')
local items = replicatedStorage:WaitForChild('Items')
local scrollingFrame = script.Parent.ItemFrameHolder.ScrollingFrame
local uiGridLayout = script.Parent.ItemFrameHolder.ScrollingFrame.UIGridLayout
uiGridLayout.CellSize = UDim2.new(0, scrollingFrame.AbsoluteSize.X / 5, 0, scrollingFrame.AbsoluteSize.X / 5)
workspace.CurrentCamera:GetPropertyChangedSignal('ViewportSize'):Connect(function()
uiGridLayout.CellSize = UDim2.new(0, scrollingFrame.AbsoluteSize.X / 5, 0, scrollingFrame.AbsoluteSize.X / 5)
end)
Script: