Try just breaking apart the problem, see if you can turn it left and right with just the X first, and then see if you can go up and down with just the Y
I made this freecam script a while back for a small project I was making; maybe it can be of some use to you
local UserInputService = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
for i = 1,10 do
camera.CameraType = Enum.CameraType.Scriptable
task.wait()
end
camera.CFrame = CFrame.lookAt(workspace.Baseplate.Position - workspace.Baseplate.CFrame.RightVector * 15 + Vector3.new(0,15,0), workspace.Baseplate.Position)
local Freecam = {}
local sensitivity = 1.5
local movementSpeed = 10
local currentAngle = Vector2.new()
UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
end
end)
UserInputService.InputEnded:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
if input.UserInputType == Enum.UserInputType.MouseButton2 then
UserInputService.MouseBehavior = Enum.MouseBehavior.Default
end
end)
game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
local delta = UserInputService:GetMouseDelta()
currentAngle = currentAngle + Vector2.new(delta.Y, delta.X) * sensitivity * deltaTime
camera.CFrame = CFrame.new(camera.CFrame.Position) * CFrame.fromEulerAnglesYXZ(-currentAngle.X, -currentAngle.Y, 0)
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
camera.CFrame = camera.CFrame + camera.CFrame.LookVector * movementSpeed * deltaTime
end
if UserInputService:IsKeyDown(Enum.KeyCode.A) then
camera.CFrame = camera.CFrame + camera.CFrame.RightVector * -movementSpeed * deltaTime
end
if UserInputService:IsKeyDown(Enum.KeyCode.S) then
camera.CFrame = camera.CFrame + camera.CFrame.LookVector * -movementSpeed * deltaTime
end
if UserInputService:IsKeyDown(Enum.KeyCode.D) then
camera.CFrame = camera.CFrame + camera.CFrame.RightVector * movementSpeed * deltaTime
end
end)
return Freecam
That worked! I switched over to the Vector2 thing and at the end I added the EulerAngles instead of changing them first. Not sure how to explain it lol.