How To Make Touch Screen/Mobile Device Screen Shift Lock Button/How to Enable Shift lock while Clicking With Different Buttons

Mobile/touch Screen Version: How to Make Touch Screen/Mobile Device Screen Shift Lock Button.
First, Go into game in studio go into your player then go into Player Scripts You will find Player Module You will need to Copy That.
End that test session and paste it into this directory
game.StarterPlayer.StarterPlayerScripts
you can also follow the process of the Other Tutorial (At The Bottom of this tutorial)
Next we want to make a sort of leaderboard type of script which that will check if the Shift lock should be on or off.
This script will add a bool value when the player Joins.
Place The script in Starter Script Services


game.Players.PlayerAdded:Connect(function(plr)
	local P = Instance.new("BoolValue", plr) or 0
	P.Name = "isShiftlock"
end)

Next, we need to make a ScreenGui with a TextButton Inside.
Also add a Script inside of the Text Button.

The Script Will check if they have a touch screen and when the button is clicked shift lock will be enabled.

local UserInputService = game:GetService("UserInputService")

if UserInputService.TouchEnabled then
	script.Parent.Visible = true
else 
	script.Parent.Visible = false	
end

script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Parent.Parent.Parent.isShiftlock.Value = not script.Parent.Parent.Parent.Parent.isShiftlock.Value
end)

Finally, Go into the Camera Module in Player Module Down to line 468 and hit enter and Type this line which will update every so often (I believe every Frame) and If the Value is true Shift lock will be turned on and the opposite is true.

self.activeCameraController:SetIsMouseLocked(script.Parent.Parent.Parent.isShiftlock.Value)

There we Have it A Touch Screen/Mobile Shift lock button.
If you want to know how to Enable Shift lock when you click a different button go here (At The Bottom of this tutorial)
Any Questions or Concerns Comment Down Below.
Mobile kit if you don’t want to make it https://www.roblox.com/library/5230632802/Shift-Lock-Button.
Thanks for reading.

Computer Version: How to Enable Shift lock while Clicking With Different Buttons
First, Go into game in studio go into your player then go into Player Scripts You will find Player Module You will need to Copy That.
End that test session and paste it into this directory
game.StarterPlayer.StarterPlayerScripts
Paste it there Go into CameraModule and Find the First child of that called “MouseLockController”
Go into the script down to line 28 where you set the keys on what you wan to bind it to.
It should say

	self.boundKeys = {Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift} -- defaults

When you want to add more add a comma and then add you key Bind I did Left trigger on Xbox Controller

	self.boundKeys = {Enum.KeyCode.LeftShift, Enum.KeyCode.RightShift,Enum.KeyCode.ButtonL2} -- defaults

Next, you Need to go down to line 41 and add that other keybind to the list.
It Should Say

boundKeysObj.Value = "LeftShift,RightShift"

Then you add a comma and add what button you want In this case again the Left trigger on an Xbox Controller.

boundKeysObj.Value = "LeftShift,RightShift,ButtonL2"

Finally There is a String value Called “BoundKeys” under the Script It should say this by default.
“LeftShift,RightShift”
Again you need to add a comma after the Defaults and type the key. Again using Xbox Controller Left trigger.
“LeftShift,RightShift,ButtonL2”
And we are Done.
Mobile Version Kit I will show how to make it by yourself Bust just later because It took me like 5+ hours to make this simple kit.
Don’t worry it will only take you like 5 mins to do.

If you want to learn How to add Touch Screen/Mobile Device Screen Shift Lock Button How to Make (At The Top of this tutorial)

Any Questions or concerns Comment down below.
Thanks For Reading This.

6 Likes

This is an exact topic that was locked and unlisted a couple of hours ago, or maybe yesterday.

I wouldn’t do it again, but it’s nice that you made a resource/tutorial on how to make shift lock on mobile.

Post right here.

2 Likes

Yes It was Unlisted Due to some one flagging it thinking it was duplicated even thou it is the same Topic but One is on Mobile and the other is on Computer. I have added the Computer part to the Bottom of this one. Also I was looking for this for a while but when I look through the scripts that Roblox Made I new I had found it.

I just want to say thanks again for viewing this I spent a 5+ hours going through the modules. I got the Idea of adding shift lock ability a little bit ago while playing a game on controller the Game was called Dungeon Quest by @vCaffy . I would like to thank @itsyourdriver, @grif_0, @activefrenzy, @painted_fence,@loueque, @vCaffy for Viewing, Liking and possibly adding this feature to there game Some of these tutorials take a while and It is nice to see people appreciating the things I do. Also Special thanks to every who has viewed my tutorials/articles and also if they liked it.

4 Likes

It makes no sense why Roblox didn’t just implement this as an optional feature using BindAction. BindAction allows you to create your own button for mobile using Roblox’s default mobile UIs while also supporting PC and Console players.

1 Like

I am actually going to implement this feature in my game’s next update. For literally years, (I’m not kidding) I’ve looked for a way to implement shift lock on mobile and other devices, and this is the first method that has actually worked. All the other tutorials were either too complicated to understand, were obfuscated, or used deprecated or otherwise obsolete features that no longer worked. Again, this is the first and only method I’ve used that has actually worked. Thank you so much for this tutorial! I’m primarily an iPad user (at least when I’m not using Studio) so the fact that shift lock is implement-able (is that even a word) is just amazing. Thanks again!

I’ve also seen your other helpful tutorials. I don’t follow people very often (I think I follow less than 20 people) but I just followed you.

1 Like