local debounce = false
local cam = game.Workspace.CurrentCamera
function onTouch(part)
local human = part.Parent:findFirstChild("Humanoid")
if human == nil then return end
if debounce == false then
debounce = true
cam.CameraType = "Scriptable"
cam.CoordinateFrame = CFrame.new(
(script.Parent.CFrame * CFrame.new(0,script.Parent.Size.Z/2,0)).p,
(script.Parent.CFrame * CFrame.new(0,-script.Parent.Size.Z/2,0)).p
)
cam.Focus = CFrame.new(script.Parent.Position)
wait(10)
debounce = false
end
end
script.Parent.Touched:connect(onTouch)
COMMUNITY QUESTION
Can someone fix this camera script?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
What's wrong with it? Do you get any errors in the output?
It only works in studio.
Cameras can only be changed/edited with a LocalScript. Otherwise, you're changing the server's camera, which isn't visible to the players in a server. The reason it works in Play Solo is because all scripts run like local scripts in Play Solo.