I am having trouble with the "Custom" SortOrder on a UIGridLayout. This is the code in a localscript in the UIGridLayout:(yes it does actually run)

local grid = script.Parent

grid:SetCustomSortFunction(function(A, B) 
	return tonumber(A.Name:sub(5)) < tonumber(B.Name:sub(5)) 
end)
grid.SortOrder = "Custom"
grid:ApplyLayout()

Whenever I join on an online server, Roblox either crashes, or "shuts down." Can someone help?