Working Security Camera, need help!

Hey Developers,

For about a week now, I’ve been trying to either find a working Security Camera or make my own and cant really find/make them.

If anyone has ANY Ideas on how to make this or have seen someone make it, please let me know.
It’s for an SCP game that I’m making and I’m 2 weeks away from releasing it so if I get any help, ill appreciate it a lot!

Thank you!

2 Likes

For the monitor screens, I used ViewportFrame Handler - Custom updating objects & humanoids in VPFs and put it on a surface gui. When they click into it, you can just set their camera’s position. If you’re doing it this way (i.e. viewport frames for a real time monitor i.e. a tablet tool that you can hold and walk around with but has live feed you can see in first person) I would suggest heavily optimizing it. Make all anchored parts not update, there’s no need, and make a dynamic system that only renders stuff in the camera’s field of view, and removes anything that went out of view, including characters. It’s also important to make this not render when the localplayer can’t see the monitor, because that’s a waste of resources.

You can use something like

function partInFieldOfVision(Part)
    local vector = (Part.CFrame.Position - camera.CFrame.Position)
    local magnitude = vector.Magnitude
    if magnitude > cameraRange then return false end
    local dir = vector.unit
    local angle = math.deg(math.acos(camera.CFrame.LookVector:Dot(dir)))
    return angle < fov
end

If you define fov, cameraRange and camera somewhere, this should work to see if a given part is within cameraRange and inside fov. I use this same logic to test for seeing if a player can see a part within a given range and fov, but the logic still applies.

Of course, if you just want a camera that you click into and lose control of your character, it’s as simple as setting the camera’s type to scriptable (you must set a camera subject beforehand) and then its cframe. To change it back, set the camera type to custom and set the subject to the player’s humanoid. The wiki page about CameraTypes goes over how to make a cutscene, we want the same effect, just without the moving parts (Camera | Roblox Creator Documentation).

Here’s what it looks like in game on a screen

3 Likes

if you want to do a live camera system, do what steven is saying. If you want to do a simple camera CFrame system I suggest you look into RunService:BindToRenderStep()

This will allow you to be able to bind a function that equals the camera CFrame to a camera block’s CFrame or a specific block’s CFrame. There is also a UnbindFromRenderStep feature that would allow you to unbind that same function when needed.

Could you send the model and or the game if possible? :slight_smile:

1 Like

I was thinking about making a script that implements live feed camera into screens, and releasing it under #resources:community-resources. I’ll let you know when it’s done!

Here’s the place, I’m working on polishing things up and optimizing it before I make it a resource:

I’ve allowed copying so you can just edit it. It all exists in the startergui → surfacegui. There’s only one example right now which is putting it on a screen. I’ll make a tutorial when I finish polishing and post it to resources.

Theres nothing in staterGUI nor the game…?

Well it’d probably help if I published lol. Fixed.

1 Like

Thanks lol, appreciate it a lot :smiley:

Yup, just want to let you know in it’s current state, this isn’t too good on big games. It has to iterate all of the parts and recurse all models in your game, so if you have many, it might be slow. I’m trying to come up with a way so I don’t loop over all parts, but I haven’t come up with anything yet

1 Like