3D Rotating Viewport Not working

Hi everyone, so I’m trying to make a 3D viewport frame. I used DutchDevs video but it didn’t work. The brick isn’t even showing up. Here are the following screen shots. Thanks from John.


Right off the bat, I noticed that on Line 14, you have an invalid syntax error.

If your script isn’t working, you should always check the script analysis and output windows for any errors and try to fix those before posting here. If you can’t fix the error yourself, be sure to include it in your post.


As for your issue, this should easily be fixed by changing line 14 to the following:

Item:SetPrimaryPartCFrame(CFrame.new(ViewPortPoint))
5 Likes

I’d also suggest reading the article from developer.roblox: here

Here’s the sample code the article provides if you don’t want to go on it.

local viewportFrame = Instance.new("ViewportFrame")
viewportFrame.Size = UDim2.new(0.3, 0, 0.4, 0)
viewportFrame.Position = UDim2.new(0, 15, 0, 15)
viewportFrame.BackgroundColor3 = Color3.new(0, 0, 0)
viewportFrame.BorderColor3 = Color3.new(0.6, 0.5, 0.4)
viewportFrame.BorderSizePixel = 2
viewportFrame.BackgroundTransparency = 0.25
viewportFrame.Parent = script.Parent
 
local part = Instance.new("Part")
part.Material = Enum.Material.Concrete
part.Color = Color3.new(0.25, 0.75, 1)
part.Position = Vector3.new(0, 0, 0)
part.Parent = viewportFrame
 
local viewportCamera = Instance.new("Camera")
viewportFrame.CurrentCamera = viewportCamera
viewportCamera.Parent = viewportFrame
 
viewportCamera.CFrame = CFrame.new(Vector3.new(0, 2, 12), part.Position)

I checked it out but it didn’t work.

I’d suggest just getting a free model and looking at the code and based on that rewrite your code to fit your needs.

1 Like

Also, I tested the code I replied with and it worked, I’d suggest just using that.

I tried editing it so it’d work but it came but with this.

Can you show the code so I can see the problem?

It’s legit just what you sent to me in place of the original code.

Oh, that’s because it creates a part and makes that the part is shows.

local part = Instance.new("Part") -- this creates the part
part.Parent = viewportFrame -- this is assigning the viewport frame as its parent

Also, I was messing around with the viewports and if you create a camera part inside the model you can just set it up using properties.

1 Like