Hello, i’ve been recently trying to make a local script to make a camera rotate when you access the camera. but everything i tried to make it rotate didn’t work and i remained to this error.
I even tried to look for older topics about this but no luck.
function AttachCamera(securitycam)
if not mycamera then
return
end
newcamera.CameraType = Enum.CameraType.Scriptable
newcamera.Focus = securitycam.CFrame --* CFrame.new(Vector3.new(0,0,-0.35001))
newcamera.CoordinateFrame = securitycam.CFrame --* CFrame.new(0,0,-0.35)
newcamera.Parent = workspace
workspace.CurrentCamera = newcamera
local part = newcamera
local ori = part.CoordinateFrame
local tweenService = game:GetService("TweenService")
local changes = {
CFrame = ori + CFrame.Angles(0, 90, 0)
}
local tweenInfo = TweenInfo.new(
4, -- Time taken for a full animation
Enum.EasingStyle.Quad, -- Animation Style
Enum.EasingDirection.InOut, -- Animation Type
-1, -- Number of repeats
true, -- Reverse
1 -- Delay between animation
)
local tween = tweenService:Create(part, tweenInfo, changes)
tween:Play()
end
this is my first time trying to code with cameras