My problem is that i have to use
Camera:SetRoll(Angle), which is only available to cameras with their CameraType set to Scriptable.
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
doesn't work when the camera is on Scriptable.
Is there any other way to lock the mouse in the center, while being able to read out MouseDelta? I can't make the character fly around in first person, because that also doesn't allow me to use
TL;DR; I need a way to lock the mouse in the center of the screen while the CurrentCamera type is Scriptable, and still being able to read out InputObject.MouseDelta.
If you name a local script 'CameraScript' and place it inside StarterPlayerScripts, it will replace the default CameraScript with your script.
When using a normal local script inside somewhere that isn't StarterPlayerScripts this won't work, but if you use this method you can.
For example I can name my local script 'CameraScript' and place it in StarterPlayerScripts. I can then add this:
local userInputService = game:GetService('UserInputService') local player = game.Players.LocalPlayer local camera = workspace.CurrentCamera local mouse = player:GetMouse() wait() -- You can remove this, but I do this just in case. camera.CameraType = Enum.CameraType.Scriptable userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter userInputService.InputChanged:connect(function(inputObject) -- You can still read mouse delta. if inputObject.UserInputType == Enum.UserInputType.MouseMovement then print('Delta X:' .. tostring(inputObject.Delta.x)) print('Delta Y:' .. tostring(inputObject.Delta.x)) end end)
You can read more about this on the wiki page here.
Wait... just never move the mouse!