Help with rendering guns/tools in ViewportFrame

Hello, I’m making a shooting game and I want to have a custom hotbar UI, I already made the UI, but I’m having problems in showing the equipped gun/tool in the viewport frame (I am not good in CFrames/Positioning, sorry).

I already scripted the tool where it will be cloned and parented inside the viewport frame, I just don’t know how I can position the camera & model to be like this:
2

Here’s an image of the paths and stuff:
1

The model’s primary part is the “Body”, and I am actually using Weapon Kit’s guns. Any help would be appreciated :smiley:

ItemViewport.Camera.CFrame = CFrame.lookAt((ItemViewPort.Pistol:GetPivot() * offsetCFrame).Position, ItemViewPort.Pistol:GetPivot().Position)

something like that, you should make the offset your own, so the camera won’t be litterally inside the gun itself

Thanks for the answer, sadly I still can’t get the offset :sweat_smile:. Though thanks again! I’m not sure if it’s my offset or the viewport itself is the problem, I tried to insert a part and then distance it from the tool, I did this to get the Z value of distance and then set that as the offset, but there’s still no tool in the viewport

1 Like

Search for Viewport Fitter from @EgoMoose really great resource that does this stuff for you.

2 Likes