Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

attempt to perform arithmetic on local 'Size' (a userdata value)??????

Hello. I tried making a list GUI but when I try to do

local Size = script.Parent:FindFirstChild("Example").Size.Y
while true do
	wait()
	local wWorkspace = game.Workspace:GetChildren()
	local Delete = script.Parent:GetChildren()
	for i=1,#Delete do
		if not Delete[i].Name == "Example" or not Delete[i].Name == script.Name then
			Delete[i]:Remove()
		end
	end
	for i=1, #wWorkspace do
		local Button = script.Parent:WaitForChild("Example"):Clone()
		Button.Name = "Item/"..wWorkspace[i].Name
		Button.Parent = script.Parent
		Button.Text=wWorkspace[i].Name
		Button.Position = UDim2.new(0,0,#Delete * Size,0)
		Button.Visible= true
	end
end

it gives me:

attempt to perform arithmetic on local 'Size' (a userdata value)

The Size variable is the size of a Button. Any help?

1 answer

Y isn’t referencing the specific axis type, this of which you forgot to include. Y has two differential forms, the Offset or Scale factor. You have to define which factor type you wish to retrieve from Y

local Button = script.Parent.Example
local Size = Button.Size.Y.Offset

It’s also a better practice to apply the actual Y Offset directly within the arithmetic, to ensure you’re getting the most recent, and accurate data.

This discussion is preserved as it was. New answers, comments, and votes are closed.