Put a localscript inside StarterPlayer.StarterPlayerScripts and call it CameraScript this will override the camera CoreScript.
Inside this new script you want to create a function which will position camera and then bind this function to the RenderStepped service.
local cameraHeight = 12
local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer
local RunService = game:GetService('RunService')
local function onUpdate()
if player.Character and player.Character:FindFirstChild('Torso') then
camera.CFrame = CFrame.new(
player.Character.Torso.Position + Vector3.new(0,cameraHeight,0),
player.Character.Torso.Position
)
end
end
RunService:BindToRenderStep('Camera', Enum.RenderPriority.Camera.Value, onUpdate)
Alternative to the cameraHeight is to have that as an IntValue object as a Child of the script so that we can change the height of the camera externally. |