there are 2 different type of camera lock!
the first one is locking a camera which is simple
1st create a LocalScript inside STARTERPLAYERSCRIPTS
2nd USE THIS CODE
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
-- Set the position and focus of the camera
camera.CFrame = CFrame.new(Vector3.new(0, 10, 0), Vector3.new(0, 0, 0))
NOTED THIS LOCKS THE CAMERA TO FIXED A POSITITON IN THE WORKSPACE NOT ATTACHED TO THE PLAYER HEAD XP
the second one is
1st in the Explorer create a localscript inside starterplayerscripts
2nd copy the code and paste it
local RunService = game:GetService("RunService")
local player = game.Players.LocalPlayer
local camera = workspace.CurrentCamera
-- Adjust offset for camera positioning
local offset = Vector3.new(0, 10, 20)
RunService.RenderStepped:Connect(function()
local character = player.Character
if character and character:FindFirstChild("HumanoidRootPart") then
camera.CameraType = Enum.CameraType.Scriptable
-- Position camera relative to player, looking at player
local targetPos = character.HumanoidRootPart.Position + offset
camera.CFrame = CFrame.new(targetPos, character.HumanoidRootPart.Position)
end
end)
if you want, adjust the offset values [X,Y,Z] to set your desired locked angle
No comments:
Post a Comment