Viewport Frame Help!

Alright guys I’m back with another issue, I’m having some trouble with using a viewport frame. So basically Im making a chest opening thingy and the chest does a little animation (slides down, tween size smaller and bigger) then its supposed to show what you got, so in I have a folder in RS called ItemThings then in there I have a folder called ArmorStuff and I have, well my Armor in there but It won’t show the thing you got in the viewport frame! Any help much appreciated!

-TSL

1 Like

Anybody got anything? Any help much appreciated

1 Like

Did you add a current camera to the view port?

Image:

Yes here is the (viewport part) of the script.

local viewportFrame = openingFrame.ItemLogo
viewportFrame.Visible = true
		
local part = game.ReplicatedStorage.ItemThings.ArmorStuff[item]:Clone()
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)
1 Like

Is the camera looking at the armor?

This might be the issue, but how do I make it look at the armor (I don’t use viewport frames that often and when I did the other 2 times it worked fine)

Also it works if I replace the “part” in the script I showed with:

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
1 Like

Put the armor into workspace, lokk at it how you want it to show in the view port, copy the camera in workspace, paste it into the viewport, then set the current camera of the view port frame to the camera

2 Likes

What do you exactly mean by copy the camera?

BTW This is a local script!

1 Like

You can right click on it and press copy, or curl-c.

Yes I know but when I tried this it kept saying

 Players.domboss37.PlayerGui.Classes/Fusions.ArmorFrame.CurrentChest.Buy.LocalScript:46: attempt to index nil with 'Parent'

Its because CurrentCamera is not replicated across Roblox’s server/client boundary. im pretty sure!

1 Like

This has nothing to do with the script, do this just to the viewport.

But then how would I show the item?

1 Like

Put it in the viewport frame. This is not done automatically.

Thank you for your help @Dan_foodz but I have found the solution. I needed to reset the Armor’s position to Vector3.new(0,0,0)

Thanks anyways!

1 Like

Np, Have a good and blessed day!

1 Like

Thank you, and you too! Take care!

1 Like