local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Gui = game:GetService("GuiService")
local player = game:GetService("Players").LocalPlayer
local camera = workspace.CurrentCamera
local mouse = player:GetMouse()
local character = player.Character or player.CharacterAdded:Wait()
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace:WaitForChild("CameraLocation").CFrame
--[VARIABLES]
local CameraDirection = Vector2.zero
RunService.PreRender:Connect(function(deltaTimeRender: number)
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
local delta = UserInputService:GetMouseDelta()
print(delta)
camera.CFrame = camera.CFrame * CFrame.Angles(math.rad(-delta.Y),math.rad(-delta.X),0)
end)
The problem is when I rotate the with the mouse, it also moves the Z rotation, which angles the camera weirdly.
Is there anyway to rotate the Camera without rotating the Z axis?