I am trying to make my own custom mouse lock feature, so when you click LCtrl it will toggle it. But it displays a error.
Error: "16:55:54.662 - Players.iiLevelMaker.PlayerGui.LocalScript:8: attempt to call field 'MouseLockSwitch' (a userdata value)"
Script:
local UIS = game:GetService('UserInputService') local isShiftlock = false UIS.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.LeftControl then -- When clicking LCtrl it toggles it if isShiftlock == false then isShiftlock = true UserSettings():GetService("UserGameSettings").CameraMode = Enum.ControlMode.MouseLockSwitch() -- Toggles it on elseif isShiftlock == true then isShiftlock = false UserSettings():GetService("UserGameSettings").CameraMode = Enum.ControlMode.MouseLockSwitch() -- Toggles it off end end end)
But Idk how to use the MouseLockSwitch() feature and I tried looking up everywhere in the roblox wiki and searched on google but there's not tutorial on how to do it. It just shows this: http://wiki.roblox.com/index.php?title=API:Class/UserGameSettings/ControlMode & http://wiki.roblox.com/index.php?title=API:Enum/ControlMode
Could anyone please help, I would love it ;)