I'm trying to rotate the camera 90° and then rotate it -180° then rotate it 180°
Code:
local goingback = false
local Player = game.Players.LocalPlayer
local RunService = game:GetService("RunService")
local character = Player.Character or Player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera
repeat wait()
camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = workspace.PushTheButton.Base.CFrame + Vector3.new(10,0,0)
camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(90), math.rad(-180), math.rad(-90))
RunService.RenderStepped:Connect(function()
if camera.CFrame.RightVector.Z <= 0 and goingback == false then
camera.CFrame = camera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(1))
else -- this is where I want to detect when it is at a certain orientation
goingback = true
camera.CFrame = camera.CFrame * CFrame.fromEulerAnglesXYZ(math.rad(0), math.rad(0), math.rad(-1))
end
end)
