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.
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.
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
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.
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.
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.