Question: Is there a way to force shift lock in a script?

\Question: Is there a way to activate shift lock in a script?

1 Like

To disable and re-enable it? Yes if a script then you can script it but I don’t know if it will work

1 Like

Do you know how to disable and re enable it?

1 Like

Yes, Go to StarterPlayer and there should be an option called EnableMouseLock.

1 Like

It does not force it i want it to be forced

2 Likes

Starter player was located on explorer.

The settings is the properties window.

If you din’t see explorer, follow my steps :

  • go to view

  • explorer

  • properties

Make sure the Explorer and Properties are open for starter player

It’s not truly imposible to do that.

1 Like

Try restarting studio or playtest.

1 Like

LocalScript within the player:

game:GetService"UserInputService".MouseBehavior = Enum.MouseBehavior.LockCenter

For further reference, check out the UIS docs

1 Like

Try putting this in workspace : script.

Game : GetService"Starter Player".EnableMouseLockOption = true

Putting in Starter Player uses a Local Script

Do my script works?
Yes, it’s 100% a working script

1 Like

Wait so it goes in starter player scripts?

1 Like

Yes. If you want a toggleable system, you can do this

eventHere:Connect(function() --Enable
game:GetService"UserInputService".MouseBehavior = Enum.MouseBehavior.LockCenter
end)

eventHere:Connect(function() --Disable
game:GetService"UserInputService".MouseBehavior = Enum.MouseBehavior.Default
end)

Yes, I know that way of doing RBXConnections is bad

2 Likes

Oh yeah, people uses a computer don’t that except for mobile devices.

it doesn’t do anything, because it is just enabling option for player to shiftlock manualy

No, it will work guys.

This gonna work.

1 Like

then how the heck people get shift lock forced on tools

tool.Equipped:Connect(function()
game:GetService"UserInputService".MouseBehavior = Enum.MouseBehavior.LockCenter
end)
1 Like

The heck was enable the EnableMouseLock properties.

This function work for all devices.

i believe using userinputservice does the same result

i can still move the mouse after

Perhaps it would help more if you explained to us why you want shift lock to be forced?