FreeCamera on Button

There is a FreeCamera feature built into core of Roblox which can be activated by pressing LeftShift + P.

I want players to activate FreeCamera and deactivate it with a button on my GUI. How can I script this?

7 Likes

To be able to activate it with a button you just need to press Play, go to your PlayerGui and copy Freecam. Stop the game and paste the Freecam into StarterGui. Then go into the LocalScript inside Freecam and at the bottom under ToggleFreecam function you would add a connection to your button (you just have to call ToggleFreecam() on button click). Problem is that once Freecam is activated all guis and your mouse disappear, so you cant just disable it with the same button. You can fork the script more by making it so the gui where the button is isnt affected and making it so mouse doesnt disappear, or you could just make a keybind which will be used to deactivate the freecam.
Ive noticed some errors in the Freecam script when i was forking it for my projects: when you toggle it on it adds all the guis that are enabled into a table and disables them, but it never removes them from it, so when you toggle it off and close some guis, they will reappear next time you toggle the freecam off (you can fix this by clearing the screenGuis table before adding new guis to it).

4 Likes