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)

3 comments

3

What's wrong with it? Do you get any errors in the output?

0

It only works in studio.

0

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.