How to stop leftmost CFrame.Orientation value changing? and stop player mouse movement?

Just came back to roblox scripting after a while and wanted to make a sort of bloodborne/elden ring system (currently trying to implement the camera lock on from those games), but im running into two issues.

The first is that it locks on to the part, but im having problems with the leftmost value of the cameras CFrame Orientation, one is that I want the value to be much lower and fixed, the problem is that the value is around -1 at distance when I would want it to be -20, and when I approach the part it gets drastically lower (perhaps this wouldnt be a problem if the value was fixed to just be lower?)

The second is that the lock on works fine as is, but when the player moves the mouse around it like moves slightly to the side and then looks back onto the part, I was researching on how to disable player mouse movements (just while the “Cameralock” is active) but wasnt able to find any solutions

My cameralock localscript:

local UserInputService = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local part = game:GetService('Workspace').TestCamPart
local RunService = game:GetService('RunService')
local isLocked = false

UserInputService.InputBegan:Connect(function(i, g)
	if not g and i.KeyCode == Enum.KeyCode.LeftAlt then
		print("LeftAlt Pressed")
		
		if isLocked then
			isLocked = false
			RunService:UnbindFromRenderStep("Cameralock")
		else
			isLocked = true
			print(part.Position)
			RunService:BindToRenderStep("Cameralock", 1, function()
				camera.CFrame = CFrame.lookAt(camera.CFrame.Position, part.Position)
			end)
		end
	end
end)

A solution for either of my problems would be greatly appreciated :slight_smile:

1 Like

i have tried a few things for example just making the block alot lower but it looks really bad when the player gets too close

1 Like