Viewport Frames Not working

So, I’ve been trying to make a display that shows the item you’re purchasing. There’s one problem. I can’t get it to work. There are no errors. The display shows up blank, as the picture below will show. This is either just my issue, or I did something wrong.SupportPic3

SupportPic1 !

I’ve tried fixing this in several ways, one of them being looking at the example they had on the developer wiki.

1 Like

Ah, you’re using a ViewportFrame!

There’s a number of things that could be happening, and all of them would have to do with the camera you’ve inserted into the viewport frame (if there aren’t any errors being displayed).

Assuming you’ve followed the example on the Dev Hub, what is that LocalScript supposed to be doing? If it modifies the properties of “ItemCam” in any way, there could be an error in camera manipulation. Does the item appear before you test the game? Do you know the exact 3D position of both the camera and the item?

One idea I have, just based on this primary information, is to move the LocalScript to be a direct child of “ItemViewer” instead of “ItemCam,” and see if that changes anything.

Maybe try this method instead:

Move the LocalScript to be a direct child of the ItemVeiwer and delete the ItemCam. Then, try replacing your code with this:

-- we need a clone of the TargetBrick inside of the ViewportFrame so that the VeiwportFrame knows what to render
local target = workspace:WaitForChild("TargetBrick"):Clone()
target.Parent = script.Parent

-- Create a new Camera instance and set it's CFrame to the TargetBrick's CFrame
local camera = Instance.new("Camera")
camera.Parent = script.Parent
camera.CFrame = CFrame.new(target.Position + Vector3.new(5, 5, 5), target.Position)

-- set the ViewportFrame's CurrentCamera to the new camera instance
script.Parent.CurrentCamera = camera

I hope this helps :slight_smile:

4 Likes

Thanks for the help! Appreciate it. :grinning:

1 Like

Hey. I am from Future. I just wanted to thank you SO MUCH
I was trying to learn ViewportFrames. and your script with "–'s " really helped me I am really Thankfull to you. I Know youu proably won’t see this buu I AM REALLY THANKFULL to for that. I love you.Have a nice day king.

1 Like