local C=game:GetService("\085\115\101\114\073\110\112\117\116\083\101\114\118\105\099\101")local F=C.TouchEnabled if F then local C=game.Players.LocalPlayer:WaitForChild("\080\108\097\121\101\114\071\117\105")local F=game.Players.LocalPlayer:WaitForChild("\080\108\097\121\101\114\083\099\114\105\112\116\115")local l="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\109\111\117\115\101\076\111\099\107\095\111\102\102\046\112\110\103"local B="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\117\105\047\109\111\117\115\101\076\111\099\107\095\111\110\046\112\110\103"local h="\114\098\120\097\115\115\101\116\058\047\047\116\101\120\116\117\114\101\115\047\077\111\117\115\101\076\111\099\107\101\100\067\117\114\115\111\114\046\112\110\103"local K=(F:WaitForChild("\080\108\097\121\101\114\077\111\100\117\108\101")).CameraModule local y=(require(K)).new()local R=require(K.MouseLockController)y.activeMouseLockController=R.new()local c=y.activeMouseLockController:GetBindableToggleEvent()if c then c:Connect(function()y:OnMouseLockToggled()end)end local o=y.activeMouseLockController local G=Instance.new("\070\114\097\109\101")G.Name="\066\111\116\116\111\109\076\101\102\116\067\111\110\116\114\111\108"G.Size=UDim2.new(.1,0,.1,0)G.Position=UDim2.new(1,0,1,0)G.AnchorPoint=Vector2.new(1,1)G.BackgroundTransparency=1 G.ZIndex=10 G.Parent=script.Parent local U=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")U.Name="\077\111\117\115\101\076\111\099\107\076\097\098\101\108"U.Size=UDim2.new(1,0,1,0)U.Position=UDim2.new(0,0,0,0)U.BackgroundTransparency=1 U.Image=l U.Visible=true U.Parent=G local P=Instance.new("\070\114\097\109\101")P.Name="\077\105\100\100\108\101\073\099\111\110"P.Size=UDim2.new(.1,0,.1,0)P.Position=UDim2.new(.5,0,.5,0)P.AnchorPoint=Vector2.new(.5,.5)P.BackgroundTransparency=1 P.ZIndex=10 P.Visible=false P.Parent=script.Parent local e=Instance.new("\073\109\097\103\101\066\117\116\116\111\110")e.Name="\077\111\117\115\101\076\111\099\107\076\097\098\101\108"e.Size=UDim2.new(1,0,1,0)e.Position=UDim2.new(0,0,0,0)e.BackgroundTransparency=1 e.Image=h e.Visible=true e.Parent=P local Y=Instance.new("\085\073\065\115\112\101\099\116\082\097\116\105\111\067\111\110\115\116\114\097\105\110\116")Y.AspectRatio=1 Y.DominantAxis="\072\101\105\103\104\116"Y.Parent=G;(Y:Clone()).Parent=P c:Connect(function()local C=y.activeMouseLockController:IsMouseLocked()U.Image=C and B or l if SHOW_CENTER_CURSOR then P.Visible=C end end)U.Activated:connect(function()o:DoMouseLockSwitch(0,Enum.UserInputState.Begin)end)end


local UserInputService = game:GetService('UserInputService')

local IsMobile = UserInputService.TouchEnabled --Is true if on mobile.

if IsMobile then --Only does things if it's on mobile.
	local PlayerGui = game.Players.LocalPlayer:WaitForChild"PlayerGui"
	local PlayerScripts = game.Players.LocalPlayer:WaitForChild"PlayerScripts"
	
	local SHIFT_LOCK_OFF = 'rbxasset://textures/ui/mouseLock_off.png'
	local SHIFT_LOCK_ON = 'rbxasset://textures/ui/mouseLock_on.png'
	local SHIFT_LOCK_CURSOR = 'rbxasset://textures/MouseLockedCursor.png'
	
	--This essentially does what the scripts do for non-mobile players.
	--It is important to do it or else shift lock wouldn't work on mobile.
	local CM = PlayerScripts:WaitForChild"PlayerModule".CameraModule
	local CameraModule = require(CM).new()
	local MLC = require(CM.MouseLockController)
	
	CameraModule.activeMouseLockController = MLC.new()
	local toggleEvent = CameraModule.activeMouseLockController:GetBindableToggleEvent()
	if toggleEvent then
		toggleEvent:Connect(function()
			CameraModule:OnMouseLockToggled()
		end)
	end
	
	--Create the gui.
	local MouseLockController = CameraModule.activeMouseLockController
	local frame = Instance.new('Frame')
	frame.Name = "BottomLeftControl"
	frame.Size = UDim2.new(.1, 0, .1, 0)
	frame.Position = UDim2.new(1, 0, 1, 0)
	frame.AnchorPoint = Vector2.new(1,1)
	frame.BackgroundTransparency = 1
	frame.ZIndex = 10
	frame.Parent = script.Parent
	
	local ShiftLockIcon = Instance.new('ImageButton')
	ShiftLockIcon.Name = "MouseLockLabel"
	ShiftLockIcon.Size = UDim2.new(1, 0, 1, 0)
	ShiftLockIcon.Position = UDim2.new(0, 0, 0, 0)
	ShiftLockIcon.BackgroundTransparency = 1
	ShiftLockIcon.Image = SHIFT_LOCK_OFF
	ShiftLockIcon.Visible = true
	ShiftLockIcon.Parent = frame
	
	local frame2 = Instance.new('Frame')
	frame2.Name = "MiddleIcon"
	frame2.Size = UDim2.new(.1, 0, .1, 0)
	frame2.Position = UDim2.new(.5, 0, .5, 0)
	frame2.AnchorPoint = Vector2.new(.5,.5)
	frame2.BackgroundTransparency = 1
	frame2.ZIndex = 10
	frame2.Visible = false
	frame2.Parent = script.Parent
	
	local MouseLockCursor = Instance.new('ImageButton')
	MouseLockCursor.Name = "MouseLockLabel"
	MouseLockCursor.Size = UDim2.new(1, 0, 1, 0)
	MouseLockCursor.Position = UDim2.new(0, 0, 0, 0)
	MouseLockCursor.BackgroundTransparency = 1
	MouseLockCursor.Image = SHIFT_LOCK_CURSOR
	MouseLockCursor.Visible = true
	MouseLockCursor.Parent = frame2
	
	local arc = Instance.new("UIAspectRatioConstraint")
	arc.AspectRatio = 1
	arc.DominantAxis = "Height"
	arc.Parent = frame
	arc:Clone().Parent = frame2
	
	--This event fires when shift lock is activated.
	--It just changes the icon.
	toggleEvent:Connect(function()
		local IsLocked = CameraModule.activeMouseLockController:IsMouseLocked()
		ShiftLockIcon.Image = IsLocked and SHIFT_LOCK_ON or SHIFT_LOCK_OFF
		if SHOW_CENTER_CURSOR then
			frame2.Visible = IsLocked
		end
	end)
	
	--When the icon is pressed, get the camera module to toggle shift lock.
	ShiftLockIcon.Activated:connect(function()
		MouseLockController:DoMouseLockSwitch(0, Enum.UserInputState.Begin)
	end)
end
