How can I check if my LockCenter is true?

How can I check if my LockCenter is true?

local uis = game:GetService("UserInputService")

local LockerCenter = --what should I do here?

uis.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Q and LockCenter == true then
        print("Hey it is true")
end
end)
local uis = game:GetService("UserInputService")

local LockerCenter = true

uis.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Q and LockCenter == true then
        print("Hey it is true")
   end
end)

My bad, I thought it was just to see if the “LockCenter” was true. Yes, as @EmbatTheHybrid said to check if the player has lockCenter you have to get their MouseBehavior.

    if input.KeyCode == Enum.KeyCode.Q and LockCenter == true then

Try this

if input.KeyCode == Enum.KeyCode.Q and uis.MouseBehavior == Enum.MouseBehavior.LockCenter then
2 Likes

Hahahahah you are that guy!!

Man you helped so many times!

Thank you and everytime it is correct :heart: :relaxed:

2 Likes

Haha! Anytime! I would recommend reading the API firstly to see if something exactly matches what you want to do!

If you have anymore issues don’t be afraid to make another post!

2 Likes