Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to do a live CCTV camera? (Prison Life ect..)

Asked by 5 years ago

I tried with my own script but the result was a simple mini-map, and I wondered if someone could help me or link a helpful Video or Website

0
what you could do, is when you press a button or whatever, you make the camera's CFrame teh CFrame of the CCTV tonyv537 95 — 5y
0
You can change the position of LocalPlayer's CurrentCamera once they inform their client that they wish to look at the camera. A lot of new CCTV-type camera options will open up once ViewportFrames are fully released. SummerEquinox 643 — 5y
0
Look at my answer and see if it works tonyv537 95 — 5y

2 answers

Log in to vote
2
Answered by
joeldes 201 Moderation Voter
5 years ago
Edited 5 years ago

Not sure what you have already tried. But here is what I would do.

You need to make it so that when the player clicks into the security camera, or whatever it is, their CurrentCamera will snap to the location of the security camera (or it's hypothetical lens).

You can do this with CFrame by reading these articles:

Camera Manipulation Tutorial

Wiki Document about the "CurrentCamera" or players camera.

Wiki Document about the Camera

Then when the player is done viewing you need to return the camera to its original state of being "the player's camera".

So read this: How to fix the camera after manipulating it.

All these resources could be found with Google, but all you really needed was a little spark of outside the box thinking and some guidance. So I hope that this leads you in the right direction.

Ad
Log in to vote
0
Answered by 5 years ago

Hello,

I know it's your question is more of a request, but I thought I would take the time out to do this for you.

What You Want

So from what I have read, I'm guessing you want to look from the perspective of a CCTV camera. In the following script, I have done it from when you press a button. I will explain it.

Hierarchy

-- ScreenGui

--- TextButton

----LocalScript

-- Variables
local plr = game.Players.LocalPlayer
local char = plr.Character
local button = script.Parent
local camera = game.Workspace.CurrentCamera
local campart = game.Workspace.Part -- Make a part in workspace and put it in front of the camera. And make it transparent
local viewing = false

-- Define function ( this is a function we will call later.) This is what we want to happen.

function LookAtCam()
    if viewing == false then -- checks if the variable is false ( this is so that it can be done again.
    camera.CameraType = "Scriptable" -- Makes the camera unable to be moved
    camera.CFrame = campart.CFrame -- Makes the player's camera look from the part when your CCTV is
    viewing = true --  set the variable to true

    elseif viewing == true then -- if the variable is true

    camera.CameraType = Enum.CameraType.Custom -- make the camera normal again
    camera.CameraSubject = plr.Character -- make it look at the character
    viewing = false -- make the variable false, so it can be repeated again
    end
    end

-- Call the function ( so when you want the function to occur)
button.MouseButton1Click:Connect(LookAtCam)

If you are struggling, Here is a place which you can use and copy. Place

Camera.Cframe

If this helped, please Up Vote / Accept the answer!

Answer this question