The code is supposed to activate on the press of the button, and it’s purpose is to simulate Mouselock; but for mobile users.
The error occurs on line 5, & 11. CM.activeCameraController:SetMouseLockOffset(Vector3.new(1.75,0,0))
I didn’t create this code, it was given to me and it’s been broken for a while.
Local Script
local CM,UIS = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild('PlayerModule'):WaitForChild('CameraModule')),game:GetService('UserInputService')
script.Parent.Parent.Enabled = UIS.TouchEnabled
script.Parent.MouseButton1Click:Connect(function(input,GPE)
CM.activeCameraController:SetMouseLockOffset(Vector3.new(1.75,0,0))
CM.activeCameraController:SetIsMouseLocked(not CM.activeCameraController:GetIsMouseLocked())
script.Parent.ImageLabel.ImageColor3 = CM.activeCameraController:GetIsMouseLocked() and Color3.fromRGB(125,255,125) or Color3.fromRGB(45, 45, 45)
end)
script.Parent.TouchTap:Connect(function(input,GPE)
CM.activeCameraController:SetMouseLockOffset(Vector3.new(1.75,0,0))
CM.activeCameraController:SetIsMouseLocked(not CM.activeCameraController:GetIsMouseLocked())
script.Parent.ImageLabel.ImageColor3 = CM.activeCameraController:GetIsMouseLocked() and Color3.fromRGB(125,255,125) or Color3.fromRGB(45, 45, 45)
end)
Any help is appreciated.