LocalPlayer = game.GetService(game, 'Players').LocalPlayer UserGameSettings = UserSettings():GetService('UserGameSettings') RunService = game.GetService(game, 'RunService') IsItOn = false -- getgenv().sl UI = { MainGui = Instance.new'ScreenGui', MouseLock = Instance.new'Frame', Container = Instance.new'Frame', Background = Instance.new'Frame', UICorner = Instance.new'UICorner', UIStroke = Instance.new'UIStroke', Icon = Instance.new'Frame', ImageLabel = Instance.new'ImageLabel', UIAspectRatioConstraint = Instance.new'UIAspectRatioConstraint', Button = Instance.new'TextButton', Crosshair = Instance.new'ImageLabel' } UI.MainGui.Name = 'MouseLockGui' UI.MainGui.Parent = gethui() or game.GetService(game, 'CoreGui') UI.MouseLock.Size = UDim2.new(0, 44, 0, 44) UI.MouseLock.BackgroundTransparency = 1 UI.MouseLock.BorderSizePixel = 0 UI.MouseLock.Position = UDim2.new(0, 15, 0, 0) UI.MouseLock.Parent = UI.MainGui UI.Container.Size = UDim2.new(1, 0, 1, 0) UI.Container.BackgroundTransparency = 1 UI.Container.BorderSizePixel = 0 UI.Container.Parent = UI.MouseLock UI.Background.Size = UDim2.new(1, 0, 1, 0) UI.Background.BackgroundColor3 = Color3.fromRGB(18,18,21) UI.Background.BackgroundTransparency = 0.08 UI.Background.BorderSizePixel = 0 UI.Background.Parent = UI.Container UI.UICorner.CornerRadius = UDim.new(1,0) UI.UICorner.Parent = UI.Background UI.UIStroke.Color = Color3.fromRGB(0,170,255) UI.UIStroke.Thickness = 2 UI.UIStroke.Transparency = 0.2 UI.UIStroke.Enabled = false UI.UIStroke.Parent = UI.Background UI.Icon.Size = UDim2.new(1,0,1,0) UI.Icon.BackgroundTransparency = 1 UI.Icon.ZIndex = 5 UI.Icon.Parent = UI.Container UI.ImageLabel.AnchorPoint = Vector2.new(.5,.5) UI.ImageLabel.Position = UDim2.new(.5,0,.5,0) UI.ImageLabel.Size = UDim2.new(.7,0,.7,0) UI.ImageLabel.BackgroundTransparency = 1 UI.ImageLabel.Image = 'rbxassetid://80450981243325' UI.ImageLabel.Parent = UI.Icon UI.UIAspectRatioConstraint.Parent = UI.ImageLabel UI.Button.Size = UDim2.new(1,0,1,0) UI.Button.BackgroundTransparency = 1 UI.Button.ZIndex = 6 UI.Button.Text = '' UI.Button.Parent = UI.Container UI.Crosshair.Name = 'Crosshair' UI.Crosshair.Parent = UI.MainGui UI.Crosshair.Size = UDim2.new(0, 30, 0, 30) UI.Crosshair.Position = UDim2.new(0.5, 0, 0.45, 0) UI.Crosshair.AnchorPoint = Vector2.new(0.5, 0.5) UI.Crosshair.BackgroundTransparency = 1 UI.Crosshair.Image = 'rbxassetid://85514680408407' UI.Crosshair.Visible = false UI.Crosshair.ZIndex = 10 RunService.PostSimulation:Connect(function() if IsItOn ~= true then return end if not workspace.CurrentCamera then return end if ((workspace.CurrentCamera.CFrame.Position.X - workspace.CurrentCamera.Focus.Position.X)^2 + (workspace.CurrentCamera.CFrame.Position.Z - workspace.CurrentCamera.Focus.Position.Z)^2) < .36 then LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0) UI.Crosshair.Visible = false else pcall(function() LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(1.7, 0, 0) end) -- added a secure call to prevent an error from popping in ur console UI.Crosshair.Visible = true end end) UI.Button.MouseButton1Click:Connect(function() IsItOn = not IsItOn if IsItOn == true then UserGameSettings.RotationType = Enum.RotationType.CameraRelative UI.UIStroke.Enabled = true elseif IsItOn ~= true then UserGameSettings.RotationType = Enum.RotationType.MovementRelative LocalPlayer.Character.Humanoid.CameraOffset = Vector3.new(0, 0, 0) UI.UIStroke.Enabled = false UI.Crosshair.Visible = false end end)