How to prevent people from turning off shiftlock?

Hey there,

I am currently in the midst of making an RPG game with shiftlock.

How I wanted to do it was that when a gun is equipped or simillar, shiftlock is forced. And when they are at the base, shiftlock gets turned off so that they can use the GUIs etc.

And I have a script that I can enable and disable it by a local script. See this post here.

But the thing is that, the player has to have shiftlock turned to “On” for it to work.
image

If it is turned to off:
image

Nothing will happen.

And I tried to turn EnableMouseLockOption
994b17999049d1ae7223104865b67856

But that basically, ruins the script somehow.

So my question is,

how can I turn the shiftlock switch to On and Off via a script.

I am not asking how to FORCE it, but merely, how to enable it on and off. Since else the script wont work.

TL:DR
How can I make it so the shiftlock setting always is at
image

Because else, people can turn it to off and the force shift lock script wont work, and it is basically game breaking.

Looking forward to answers, thank you very much!

2 Likes

This post might help you.

1 Like

Yeah, I have been pretty active on that post lately.

@skppiy4000 told me that his version probably is a little outdated. So I basically, tried his simple method and it worked perfectly, but the catch is that I want it to be toggle-able. I want it only to be active when guns are equipped. And the method to turn on and off

It doesn’t turn it off when the player is first shift-locked but merely makes so the player cant do anything.

And then I used @Mystifine’s method and that also worked great. And even to toggle the shift lock.

BUT, the script only works when the player themselves have turned the shift lock setting to on
image

And many people, I must say, will either exploit this disadvantage or most people dont even have the setting switched to “On”.

So, my quesiton is:

How can I force it to be on setting “On”.
image

Thanks

Unfortunately no matter what you do to lock it, this is a client feature and can be bypassed if enough scripting knowledge is known from a exploiter, what I did to turn it on and off was check for specific things in my character during certain conditions, say like if I was holding a tool, I’d check if the character is wearing a tool and switch it on/off, but you might be able to use remotes but the accuracy MAAY not be as good as if you did the checks locally.

The best bet is to build your scripts off the idea that this CAN be exploited, but for the most part it should stop common players from having normal cameras, you can also switch off their ability to change the shift lock from the players configurations, but I don’t know how different the new scripts are from back then, but that should give you the effect you want.

2 Likes

So do you want shift lock to be active all the time in your game?

Try using a scriptable custom camera… that’s what I do.
(Well just a suggestion)

The player object has a property called DevEnableMouseLock you can read about it here: Player | Documentation - Roblox Creator Hub

Yeah, I have nothing against that. As long as it works.

I just thought shiftlock was the easiest, but if you have a script thats fairly easy to implement and to toggle on and off, I would love too see it, and maybe get an explanation.