"Dual Render" Scope System

I get an error involving a Primary Part when I try to use the script as is. The error is as follows:

RunService:fireRenderStepEarlyFunctions unexpected error while invoking callback: Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.

This is the only error I get. I tried setting the guns primary part in the script but I had no success.

This is super neat. If ViewportFrames could be non-square, it might be possible to create a Depth of Field effect with this. Excellent work!

2 Likes

I think I have a way to be able to optimise it a bit more.
If you only render/update items then are in view.
Iā€™m pretty sure this is possible, but not 100%.
It is a great read and I will be using this and a setting for people.

Could this be transformed into a magnifying glass?

Yes it could probably work with a magnifying glass, but it would not be suitable for a real game environment like they said.

1 Like

I keep getting this error,
09:44:20.165 Model:SetPrimaryPartCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this. - Client - ViewportCameraController:47

I donā€™t know how to fix it :pensive:

This error is telling you that there is no set primary part for the model. Make sure to check if the model does have a primary part by looking at its properties, and if so then make sure nothing is setting it to nil. It may be getting destroyed as well.

How would I set the correct primary part? I know how to set one but I donā€™t know which part to set it asā€¦

hmm I downloaded the world and tried it. I see what you mean now! For some reason the cloned model of the gun does not have a primary part set, so we will have to edit the script a little to make it so it does. Sure enough, it worked! All you have to do is go into: StarterGui > ScreenGui > DualRender > and open the script called ā€œViewportCameraController.ā€ Make a line above line 47 and copy and paste this into it:

GunModel.PrimaryPart = GunModel.AimPart

It should be working now! Let me know if you have more trouble.

3 Likes

Iā€™ll check it tomorrow. Thanks for your help!

i wonder if the demo works properly on mobile. i can launch the demo world just fine, just canā€™t aim down the scope.

I added the change you suggested, worked fine in the sense the scope works fine now, granted I cannot aim and the night vision overlay is on top of the gun. No errors now at least, but not working as the demo place.

For some reason mine is broken.

hey dude this work will be fantastic if you add like a portal camera like what egomoose added in this topic:Re-Creating a Portal Effect,