Dynamically disabling the built-in Camera & Control modules

I’m currently planning to add VR support to a game. It uses the default Roblox camera and control scripts, which I want to preserve when not in VR mode, but when in VR mode I need to completely disable them, to replace them with a from-scratch solution.

I don’t just need to disable the controls, I need to demolish everything including the vignette when moving. I also need to disable the default camera behavior completely so that it will never be moved by the ModuleScripts.

The biggest requirement is that this needs to be dynamic, i.e. I need to be able to completely disable, but then also completely enable again the modules. Disabling the controls alone doesn’t disable the camera moving behavior and so on.

How can I do this?

2 Likes

image

Thanks @Forummer, but that isn’t applicable to my situation at all. I don’t need help locating the scripts. Nor would I need help completely removing them from the game if I wanted to. I just need help disabling them at runtime only in specific situations (i.e. VR headset connected). Since they’re ModuleScripts I can’t just toggle a Disabled property.

Would setting their “Disabled” properties to true/false not suffice?

If you place the PlayerModule script in StarterPlayerScripts, you are capable of modifing it.
This could be usefull for putting in your own systems or disabling them with a simple check.

1 Like

That’s true. I’d prefer not to fork them though, as that would mean all future updates would have to be applied manually.

1 Like

Well another option would just to do this:

game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"):Destroy();

This doesn’t do anything useful. It doesn’t disable the already-running code, and will just cause an error if you connect a new input method and prompt the PlayerModule to load another input handler.

1 Like