RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Make me a script where the camera angle locks the players body and movement. The keybind is z"
-- local script local UserInputService = game:GetService("UserInputService") local Players = game:GetService("Players") local player = Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local camera = workspace.CurrentCamera local locked = false local function lockCamera(input, gameProcessed) if input.KeyCode == Enum.KeyCode.Z and not gameProcessed then locked = not locked if locked then camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = character.HumanoidRootPart humanoid.AutoRotate = false else camera.CameraType = Enum.CameraType.Custom humanoid.AutoRotate = true end end end UserInputService.InputBegan:Connect(lockCamera)