When opening a new place that causes a new instance of Studio to open, there’s a decent chance that plugins which immediately grab the CurrentCamera will get some kind of “phantom” camera whose properties don’t reflect the actual CurrentCamera.
Making the plugin yield for a moment before grabbing the CurrentCamera seems to fix it.
Repro
Install this plugin. It just prints the camera’s CFrame and info about a ray created using ViewportPointToRay every couple seconds. No particular reason for testing just those things, they’re just what I was using when I ran into this.
Open a new place (an actual new place, so file → new or ctrl-n) while you already have a place open.
In the new place, move the camera around.
If the numbers in the output aren’t changing as you move the camera, the plugin got a phantom camera. Otherwise, repeat from step 2.
Unless this is somehow unique to my PC, it should definitely get a phantom within 10 attempts. I’ve only made it to 4.
Are you grabbing the CurrentCamera once on plugin startup then trying to use that for the whole Studio session? The CurrentCamera property is not guaranteed to stay the same. Roblox Studio probably makes a new Camera after the plugin has started in some cases. Users can also delete the Camera if it gets stuck or breaks somehow and Studio makes a new one.
If that’s what’s happening, then I don’t think this is a bug, but making the new Camera be created before running plugins would be nice for compatibility with plugins that don’t take changing CurrentCamera into account.
Are you grabbing the CurrentCamera once on plugin startup then trying to use that for the whole Studio session? The CurrentCamera property is not guaranteed to stay the same. Roblox Studio probably makes a new Camera after the plugin has started in some cases. Users can also delete the Camera if it gets stuck or breaks somehow and Studio makes a new one.
To fix that, I think you could just make a new reference to the camera every time you need it.
And now that you mention it, I had tried out the phantom’s CFrame and I knew that angle was familiar but I wasn’t sure why. Turns out it’s the same CFrame as the new camera when you delete the current one.