repeat task.wait() until game:GetService("Players").LocalPlayer.Character ~= nil local renderService = game:GetService("RunService") local inputService = game:GetService("UserInputService") local playerService = game:GetService("Players") local MouseToggle = {enabled = false; key = Enum.KeyCode.F;} local ShowPlayerBody = true local MouseSensitivity = 0.3 local ConsoleSensitivity = 12 local CameraSmoothness = 0.06 local CameraFOV = 60 local CameraOffset = CFrame.new(0,0.3,0) local camera = workspace.CurrentCamera local localPlayer = playerService.LocalPlayer local mouse = localPlayer:GetMouse() mouse.Icon = "http://www.roblox.com/asset/?id=569021388" local playerCharacter = localPlayer.Character or localPlayer.CharacterAdded:Wait() local humanoid = playerCharacter.Humanoid local rootPart = playerCharacter.HumanoidRootPart local playerHead = playerCharacter:WaitForChild("Head") local currentCamPos, targetCamPos = camera.CoordinateFrame.Position, camera.CoordinateFrame.Position local currentXAngle, targetXAngle = 0, 0 local currentYAngle, targetYAngle = 0, 0 local systemActive = true local mouseUnlocked = false local baseFOV = CameraFOV local forwardKey, leftKey, backKey, rightKey, sprintKey = false, false, false, false, false local smoothTime = 0.1 local movementSettings = { active = true; normalSpeed = 10; reverseSpeed = 10; strafeSpeed = 10; diagonalSpeed = 10; sprintSpeed = 10; sprintFOV = 60; } function updateCharacterVisibility() for _, part in pairs(playerCharacter:GetChildren()) do if ShowPlayerBody then if part.Name == 'Head' then part.LocalTransparencyModifier = 1 part.CanCollide = false local face = part:FindFirstChild("face") if face then face.LocalTransparencyModifier = 1 end for _, child in pairs(part:GetChildren()) do if child:IsA("Decal") then child.LocalTransparencyModifier = 1 end end end else if part:IsA'Part' or part:IsA'UnionOperation' or part:IsA'MeshPart' then part.LocalTransparencyModifier = 1 part.CanCollide = false end end if part:IsA'Accessory' then local handle = part:FindFirstChild('Handle') if handle then handle.LocalTransparencyModifier = 1 handle.CanCollide = false end end if part:IsA'Hat' then local handle = part:FindFirstChild('Handle') if handle then handle.LocalTransparencyModifier = 1 handle.CanCollide = false end end end end function interpolate(start, finish, alpha) return start * (1 - alpha) + (finish * alpha) end local touchInputActive = false inputService.TouchStarted:Connect(function(touch, processed) if not processed then touchInputActive = true end end) inputService.TouchEnded:Connect(function(touch, processed) touchInputActive = false end) inputService.TouchMoved:Connect(function(touch, processed) if not processed and touchInputActive then local deltaMovement = Vector2.new(touch.Delta.x / MouseSensitivity, touch.Delta.y / MouseSensitivity) * CameraSmoothness local newXAngle = targetXAngle - deltaMovement.y targetXAngle = math.clamp(newXAngle, -80, 80) targetYAngle = (targetYAngle - deltaMovement.x) % 360 end end) inputService.InputChanged:Connect(function(input) if input.UserInputType == Enum.UserInputType.MouseMovement and not touchInputActive then local deltaMovement = Vector2.new(input.Delta.x / MouseSensitivity, input.Delta.y / MouseSensitivity) * CameraSmoothness local newXAngle = targetXAngle - deltaMovement.y targetXAngle = math.clamp(newXAngle, -80, 80) targetYAngle = (targetYAngle - deltaMovement.x) % 360 elseif input.UserInputType == Enum.UserInputType.Gamepad1 then if input.KeyCode == Enum.KeyCode.Thumbstick2 then local deltaMovement = Vector2.new(input.Position.X * ConsoleSensitivity, input.Position.Y * ConsoleSensitivity) * CameraSmoothness local newXAngle = targetXAngle + deltaMovement.y targetXAngle = math.clamp(newXAngle, -80, 80) targetYAngle = (targetYAngle - deltaMovement.x) % 360 end end end) inputService.InputBegan:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == MouseToggle.key then mouseUnlocked = not mouseUnlocked end if input.KeyCode == Enum.KeyCode.W then forwardKey = true end if input.KeyCode == Enum.KeyCode.A then leftKey = true end if input.KeyCode == Enum.KeyCode.S then backKey = true end if input.KeyCode == Enum.KeyCode.D then rightKey = true end if input.KeyCode == Enum.KeyCode.LeftShift then sprintKey = true end elseif input.UserInputType == Enum.UserInputType.Gamepad1 then if input.KeyCode == Enum.KeyCode.ButtonA then sprintKey = true end end end) inputService.InputEnded:Connect(function(input) if input.UserInputType == Enum.UserInputType.Keyboard then if input.KeyCode == Enum.KeyCode.W then forwardKey = false end if input.KeyCode == Enum.KeyCode.A then leftKey = false end if input.KeyCode == Enum.KeyCode.S then backKey = false end if input.KeyCode == Enum.KeyCode.D then rightKey = false end if input.KeyCode == Enum.KeyCode.LeftShift then sprintKey = false end elseif input.UserInputType == Enum.UserInputType.Gamepad1 then if input.KeyCode == Enum.KeyCode.ButtonA then sprintKey = false end end end) renderService.RenderStepped:Connect(function() if systemActive then updateCharacterVisibility() currentCamPos = currentCamPos + (targetCamPos - currentCamPos) * 0.28 currentXAngle = currentXAngle + (targetXAngle - currentXAngle) * 0.35 local angleDifference = targetYAngle - currentYAngle angleDifference = math.abs(angleDifference) > 180 and angleDifference - (angleDifference / math.abs(angleDifference)) * 360 or angleDifference currentYAngle = (currentYAngle + angleDifference * 0.35) % 360 camera.CameraType = Enum.CameraType.Scriptable camera.CoordinateFrame = CFrame.new(playerHead.Position) * CFrame.Angles(0, math.rad(currentYAngle), 0) * CFrame.Angles(math.rad(currentXAngle), 0, 0) * CameraOffset rootPart.CFrame = CFrame.new(rootPart.Position) * CFrame.Angles(0, math.rad(currentYAngle), 0) else inputService.MouseBehavior = Enum.MouseBehavior.Default end if (camera.Focus.Position - camera.CoordinateFrame.Position).Magnitude < 1 then systemActive = false else systemActive = true if mouseUnlocked then inputService.MouseBehavior = Enum.MouseBehavior.Default else inputService.MouseBehavior = Enum.MouseBehavior.LockCenter end end if not MouseToggle.enabled then mouseUnlocked = false end camera.FieldOfView = CameraFOV if movementSettings.active then if forwardKey and backKey then return end if forwardKey and not sprintKey then CameraFOV = interpolate(CameraFOV, baseFOV, smoothTime) humanoid.WalkSpeed = interpolate(humanoid.WalkSpeed, movementSettings.normalSpeed, smoothTime) elseif forwardKey and leftKey then humanoid.WalkSpeed = interpolate(humanoid.WalkSpeed, movementSettings.diagonalSpeed, smoothTime) elseif forwardKey and rightKey then humanoid.WalkSpeed = interpolate(humanoid.WalkSpeed, movementSettings.diagonalSpeed, smoothTime) elseif backKey then humanoid.WalkSpeed = interpolate(humanoid.WalkSpeed, movementSettings.reverseSpeed, smoothTime) elseif rightKey then humanoid.WalkSpeed = interpolate(humanoid.WalkSpeed, movementSettings.strafeSpeed, smoothTime) elseif leftKey then humanoid.WalkSpeed = interpolate(humanoid.WalkSpeed, movementSettings.strafeSpeed, smoothTime) end if sprintKey and forwardKey then CameraFOV = interpolate(CameraFOV, movementSettings.sprintFOV, smoothTime) humanoid.WalkSpeed = interpolate(humanoid.WalkSpeed, humanoid.WalkSpeed + (movementSettings.sprintSpeed - humanoid.WalkSpeed), smoothTime) end end end)