Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local RunService = game:GetService("RunService")
- local player = Players.LocalPlayer
- local camera = workspace.CurrentCamera
- -- CONFIGURACIÓN
- local CAMERA_HEIGHT = 6
- local CAMERA_DISTANCE = 30
- -- Esperar personaje
- local character = player.Character or player.CharacterAdded:Wait()
- local root = character:WaitForChild("HumanoidRootPart")
- camera.CameraType = Enum.CameraType.Scriptable
- RunService.RenderStepped:Connect(function()
- if not character or not character.Parent then
- return
- end
- root = character:FindFirstChild("HumanoidRootPart")
- if not root then
- return
- end
- -- Posición de la cámara
- local cameraPosition = Vector3.new(
- root.Position.X,
- root.Position.Y + CAMERA_HEIGHT,
- root.Position.Z + CAMERA_DISTANCE
- )
- -- Mirar al jugador
- local targetPosition = Vector3.new(
- root.Position.X,
- root.Position.Y + CAMERA_HEIGHT,
- root.Position.Z
- )
- camera.CFrame = CFrame.lookAt(cameraPosition, targetPosition)
- end)
- player.CharacterAdded:Connect(function(newCharacter)
- character = newCharacter
- root = character:WaitForChild("HumanoidRootPart")
- end)
Advertisement
Add Comment
Please, Sign In to add comment