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

Can someone fix this camera script?

Asked by 9 years ago
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
What's wrong with it? Do you get any errors in the output? Merely 2122 — 9y
0
It only works in studio. zachhg03 35 — 9y
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. Tkdriverx 514 — 9y

Answer this question