here's the local script:
local userInputService = game:GetService("UserInputService")
game:GetService("UserInputService").InputBegan:Connect(function(input, gameProcessed) -- switches between default and lockcenter mouse behaviour
if input.KeyCode.Name == "BackSlash" then
if userInputService.MouseBehavior == 0 then
print ("locking cursor")
userInputService.MouseBehavior = 1
else
print("unlocking cursor")
userInputService.MouseBehaviour = 0
end
end
end)
and i get
unlocking cursor - Client - unlockCursor:9
MouseBehaviour is not a valid member of UserInputService "Instance" - Client - unlockCursor:10
as the output every time i press backslash

4 comments
i think using Enum.MouseBehavior will help, for example: Enum.MouseBehavior.LockCenter
that's what i tried at first, it had the same result
i read the dev wiki, i believe you did it wrong. the value "0" does not exist.
if you wanna set it to default, make the value to "1". if lock, make the value to "2"