Attempt to perform arithmetic (mul) on Instance and number

  20:19:49.401  Players.Techononux3.PlayerScripts.ShopUiHandler:20: attempt to perform arithmetic (mul) on Instance and number  -  Client

its suppose to get each child instance in a folder and display them from the info in the folder

-- instances 
local rs = game:GetService("ReplicatedStorage")
local assets = rs:WaitForChild("Assets")
local functions = rs:WaitForChild("Functions")
local event = functions:WaitForChild("OpenShopUi")

local shopGuiData = assets:WaitForChild("Gui"):WaitForChild("Shop")
local shopGui = shopGuiData:WaitForChild("ShopGui")
local shopTile = shopGuiData:WaitForChild("ShopTile")
local gui = game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("ScreenGui")
event.OnInvoke = function(data:Instance)
	local tiles = data.Tiles
	local title = data.ShopTitle.Value
	local shopGui = shopGui:Clone()
	local shopTile = shopTile:Clone()
	shopGui.Parent = gui
	shopGui.Header.TextLabel.Text = title
	for tileData,i in pairs(tiles:GetChildren()) do
		local tile = shopTile:Clone()
		tile.Position = UDim2(0,0,i*1.2,0)
		tile.ItemLabel.Text = tileData.NameValue.Value
	end
end

image

You accidentally reversed for tileData,i. Should be for i,tileData

now its

20:26:48.456  Players.Techononux3.PlayerScripts.ShopUiHandler:20: attempt to call a table value  -  Client

line 20 tile.Position = UDim2(0,0,i*1.2,0)

not sure what i have done wrong here

You’re doing UDim2, which is just a table of functions. Pretty sure you’re meant to do UDim2.new() instead in your case.
Also, quick tip, there’s a UI object called UIGridLayout that does grid and tile related stuff for you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.