Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

UserInputService is throwing errors when i try to lock/unlock the cursor?

Asked by 2 years ago
Edited 2 years ago

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

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

Answer this question