I have been experiencing this issue in my code and haven't figured out why it is returning this error: attempt to call a Instance value when I send an instance to a function

The line of code and some of the code around it:

sitemr = script.Parent.Hotbar[tostring(b)]
			if sitem.amount > 1 then	
				sitemr.ImageLabel.TextLabel.Text = sitem.amount
			else
				sitemr.ImageLabel.TextLabel.Text = ""
				
			end
			if sitem.amount > 0 then
				if minecraftitems[sitem.itemtype] then
					sitemr.ImageLabel.Image = minecraftitems[sitem.itemtype]
				end
				if not minecraftitems[sitem.itemtype]and blocks[sitem.itemtype]then
					if not sitemr.ViewportFrame.Block:FindFirstChildOfClass("Texture") then 
						tex(sitemr.ViewportFrame.Block,sitem.itemtype,false,false,false,false,false,false)
					end
				end
			else
				sitemr.ImageLabel.Image = ""
				sitemr.ViewportFrame.Block.Transparency = 1
				sitemr.ViewportFrame.Block:ClearAllChildren()
			end
function texturize(part,blocktype,left,right,front,back,topp,bottom)
	if blocks[blocktype].onetexture == true then 
		if not front then
			top=tex:Clone()
			top.Name = "TexFront"
			top.Parent = part
			top.Texture = blocks[blocktype].tex
			top.Face = "Front"
		end
		if not back then
			top=tex:Clone()
			top.Name = "TexBack"
			top.Parent = part
			top.Texture = blocks[blocktype].tex
			top.Face = "Back"
		end
		if not left then
			top=tex:Clone()
			top.Name = "TexLeft"
			top.Parent = part
			top.Texture = blocks[blocktype].tex
			top.Face = "Left"
		end
		if not right then
			top=tex:Clone()
		top.Name = "TexRight"
		top.Parent = part
		top.Texture = blocks[blocktype].tex
			top.Face = "Right"
		end
		if not topp then
			top=tex:Clone()
		top.Name = "TexTop"
		top.Parent = part
		top.Texture = blocks[blocktype].tex
			top.Face = "Top"
		end
		if not bottom then
			top=tex:Clone()
		top.Name = "TexBottom"
		top.Parent = part
		top.Texture = blocks[blocktype].tex
			top.Face = "Bottom"
		end
	else
		if not front then
			top=tex:Clone()
			top.Name = "TexFront"
			top.Parent = part
			top.Texture = blocks[blocktype].texfront
			top.Face = "Front"
		end
		if not back then
			top=tex:Clone()
			top.Name = "TexBack"
			top.Parent = part
			top.Texture = blocks[blocktype].texback
			top.Face = "Back"
		end
		if not left then
			top=tex:Clone()
			top.Name = "TexLeft"
			top.Parent = part
			top.Texture = blocks[blocktype].texleft
			top.Face = "Left"
		end
		if not right then
			top=tex:Clone()
			top.Name = "TexRight"
			top.Parent = part
			top.Texture = blocks[blocktype].texright
			top.Face = "Right"
		end
		if not topp then
			top=tex:Clone()
			top.Name = "TexTop"
			top.Parent = part
			top.Texture = blocks[blocktype].textop
			top.Face = "Top"
		end
		if not bottom then
			top=tex:Clone()
			top.Name = "TexBottom"
			top.Parent = part
			top.Texture = blocks[blocktype].texbottom
			top.Face = "Bottom"
		end
	end
end

Thanks in advance!

1 comment

0

I just noticed that the function I was calling didn't exist.