game.Workspace.Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Head")
This does what I want, but it just breaks shift lock. How do I do it so that doesn’t happen?
game.Workspace.Camera.CameraSubject = game.Players.LocalPlayer.Character:WaitForChild("Head")
This does what I want, but it just breaks shift lock. How do I do it so that doesn’t happen?
local player = game.Players.LocalPlayer
local camera = game.Workspace.CurrentCamera
local head = player.Character:WaitForChild("Head")
-- Adjust the offset to your preference
local offset = Vector3.new(0, 2, 0)
-- Function to update the camera position
local function updateCamera()
local headPosition = head.Position + offset
camera.CFrame = CFrame.new(headPosition, headPosition + head.CFrame.LookVector)
end
-- Connect the function to the render step
game:GetService("RunService").RenderStepped:Connect(updateCamera)
This script fetches the local player, the camera, and the player’s head. It then sets up a function updateCamera that adjusts the camera’s position based on the player’s head position with an offset. Finally, the script connects the updateCamera function to the RenderStepped event to continuously update the camera position.
Remember to place this script in a location where it will run, such as in StarterPlayer > StarterPlayerScripts. Adjust the offset value to suit your desired camera position.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.