Using OOP to make camera placement


Pretty strange thing but what I’m trying to do is make a system that allows you to add and remove cameras. The cameras are parts in game, and then you can operate these cameras via some other code. My goal is to have it like this:

User clicks “Add camera” button, then a grid with a small block comes up. Then, when a user clicks it, the block gets placed at that position. When a user hits the access cameras button, they are watching the view of this camera (the access camera button I know how to do). My only issue is how can I allow the user, then to delete the camera by clicking on it, I think I have a general idea on what to do but just the Part placement is the bit I’m kind of stuck on.

There will be no plot, the player can place a camera anywhere around the map.

Here is a short workflow of how this would work:

  1. Click the add camera button

  2. Use RenderStepped and update the position of the camer model to mouse.Hit.

  3. Detect player mouse click, disconnect the RenderStepped and fire a remote event with the CFrame of the model

  4. Detect event firing and place the camera at the CFrame that was passed

Tip: For the delete camera option, you can get mouse.Target and check if the target is a camera (make sure to check it server sided too)

Hope it helps!

1 Like

Thanks for your reply, I’ll make this as the solution if it works.

1 Like