Solved ty for the help

solved thanks for everyone that helped

Would this work?

local Camera = workspace.CurrentCamera
Camera.CFrame = CFrame.new(Camera.CFrame.p, part.Position*Vector3.new(1,0,1))

(edit: i was really tired when i wrote this oh wow thats a terrible solution)

I guess you could add the mouse delta Y to the Cframe orientation.

Something like

local Camera = workspace.CurrentCamera

Camera.CameraType = Enum.CameraType.Scriptable

local part = workspace.Part

local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local DeltaY = 0
RunService.RenderStepped:Connect(function()
	local Delta = UserInputService:GetMouseDelta()
	DeltaY += -Delta.Y
	Camera.CFrame = CFrame.new(Camera.CFrame.p, part.Position+Vector3.new(0, DeltaY, 0))
end)

This might error because I just wrote it without testing.

Edit: Fixed a typo
Edit 2: Fixed an error after testing, This now works

You could keep track of a variable denoting the camera view’s height that’s changed every time the player’s cursor has a change in its y position. You could detect the change in position with GetMouseDelta(), then you could define the CFrame as Camera.CFrame = CFrame.new(Camera.CFrame.p, Vector3.new(part.Position.X, part.Position.Y + DeltaY, part.Position.Z)).

Well, it should work. It’s similar to what I do in my game. Can I see your code, specifically where you get the DeltaY variable?

Well, if you want to rotate the camera up and down, that means you are rotating on the X-axis. If you want the camera to move left and right, that is called the Y-axis. For the Z, that’s just like… tilting?

AFK

You’ll want to separate getting the DeltaY and calculating the CFrame into two different events. Also, you need to lock your mouse for this behavior to work.

local Camera = workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable

local part = workspace.Part

local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local DeltaY = 0

RunService.RenderStepped:Connect(function()
	Camera.CFrame = CFrame.new(Camera.CFrame.p, part.Position + Vector3.new(0, DeltaY, 0))
end)

UserInputService.InputChanged:Connect(function(Input, GameProcessed)
	UserInputService.MouseBehavior = Enum.MouseBehavior.LockCurrentPosition
	
	local Delta = UserInputService:GetMouseDelta()
	DeltaY += -Delta.Y / 10
end)

This should work. It’ll be a bit choppy but you can just smooth that out by using AlignPosition or something.

I think I have figured it out thank you for your help

Cool. Could you mark my reply as the answer? Thanks.

Why did you delete all of your posts?

1 Like