I'm trying to use a Viewport Frame but its not working

This is a support category for asking questions about how to get something done on the Roblox websites or how to do something on Roblox applications such as Roblox Studio.

I want to make a block appear on the Viewport Frame but its not working

The issue is that when i parent the block to the Viewport Frame, the block isn’t appearing on the Frame.

Here is the code:

local function PutItemOnGuiScreen(item: Instance)
	item:Clone().Parent = script.Parent.Parent:WaitForChild("ItemShowGUI"):WaitForChild("ViewportFrame")
end
PutItemOnGuiScreen(workspace:WaitForChild("ItemFolder"):WaitForChild("Block"))

script.Parent:WaitForChild("RollButton"):WaitForChild("TextButton").Activated:Connect(function()
	local itemCount = 0

	while itemCount < AMMOUNT_OF_THINGS do
		local itemsCounted = 0
		local randomThing = math.random(1, totalItems)
		for _, v in Items do
			itemsCounted += 1
			if itemsCounted == randomThing then
				PutItemOnGuiScreen(v)
				script.Parent.Parent:WaitForChild("ItemShowGUI"):WaitForChild("TextFrame"):WaitForChild("TextLabel").Text = v.Name
				script.Parent.Parent:WaitForChild("ItemShowGUI"):WaitForChild("TextFrame"):WaitForChild("TextLabel").TextColor3 = Color3.fromRGB()
			end
		end
		itemCount += 1
		wait(WAIT_TIME)
	end
	Remotes:WaitForChild("SpinRemote"):FireServer()
end)

I’m new to Viewport Frames so idk how to use them in code.

1 Like

I solved it myself. I forgot to anchor the parts so they fell and they weren’t seen by the camera.

3 Likes

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