UserInputService.MouseBehavior not working

Hello, ive seen for a few days that UserInputService.MouseBehavior is not working, same as shift lock in Roblox Studio, right now i was trying to recreate the old roblox shift lock movement in this tool, and i cant lock my mouse in the center of the screen.

I finished the movement system but my mouse is not locking.

https://gyazo.com/fe40a25ec7114d4471d71e988d943549

https://gyazo.com/8beef54b8e8c4b7280212a32f1fb4b81

I tried a lot of solutions but none of them worked, aparently the problem is MouseBehavior wich acts useless in the script, i dont know if im doing something wrong or this is just a bug.

This is the part that is not working.

HeartBeat = RunService.RenderStepped:Connect(LockCamera) -- Local function using maths and more
GameSetting.RotationType = Enum.RotationType.CameraRelative -- Works.
UserInputService.MouseBehavior = Enum.MouseBehavior.LockCenter -- This acts useless

Thanks for reading!

I recommend using BindToRenderStep and choosing the RenderPriority of Camera plus one.

RunService:BindToRenderStep("name", Enum.RenderPriority.Camera + 1, function)

Should work.

I forgot to say i have tried that, but aswell dint worked for me

This worked for me. Turns out that Enums don’t “become” integers. You have to use their Value property.

local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")

runService:BindToRenderStep("mouseBehavior", Enum.RenderPriority.Camera.Value + 1, function()
  userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end)

As i said, its not working, Im using everything propertly and still not working, MouseBehavior just makes my camera dont rotate, but mouse is able to move, same as what happend with your code example

Well this works for me. I’m not sure how it’s not working for you nor what behavior you want. Thank you though, I’ve finally figured out how lock the camera to “third person shift lock” without modifying the default scripts. https://streamable.com/xr08v0

local runService = game:GetService("RunService")
local userInputService = game:GetService("UserInputService")
local userSettings = UserSettings():GetService("UserGameSettings")

runService:BindToRenderStep("mouseBehavior", Enum.RenderPriority.Camera.Value + 1, function()
  userSettings.RotationType = Enum.RotationType.CameraRelative
  userInputService.MouseBehavior = Enum.MouseBehavior.LockCenter
end)

For some reason, nothing related to mouse interation is working for me in studio, i asked a lot of friends and all of them said their studio works pretty well, if this just happends to me im very sorry for making you waste time, ill figure this out asking staff or ill download studio another time