I looked it up and found nothing. Please help?
COMMUNITY QUESTION
How do i press a button and make my camera look at a part?
1 answer
Step 1: Put a ClickDetector in a part. Step 2: Put a script in the part with the following code:
local part = game.Workspace.Part -- Replace "Part" with the name of the part.
part.ClickDetector.MouseClick:connect(function(player)
local cam = workspace.Camera
cam.CameraType = "Custom"
cam.CameraSubject = part
end)
4 comments
0
Only works when i set it to part. Why?
0
Don't know what you mean by that...
0
The script only works when i set the subject to "part" which is a part in workspace.
0
You have to have it focused on a part, it can't be anything else.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
http://wiki.roblox.com/index.php?title=API:Class/ClickDetector/MouseClick http://wiki.roblox.com/index.php?title=API:Class/Camera/CameraSubject http://wiki.roblox.com/index.php?title=API:Class/Camera/CFrame http://wiki.roblox.com/index.php?title=API:Class/Camera/CameraType
didn't work. I put it in a local script. I'm not testing the click detector part of the script yet...