Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why wont the camera follow this part?

Asked by
Chronomad 180
7 years ago

I'm attempting to get the camera to focus on a part that is following the players movements in order to replicate a sort of mouse lock. The problem is, the camera only seems to get set to the parts position once and then sit there. Thanks in advance for any help you can offer!

local player = game:GetService("Players").LocalPlayer 
local RigCamera = game.ReplicatedStorage:WaitForChild("RemoteCam") 
local CamSetup = game.ReplicatedStorage.LocalPlayerResources.Camera
C = CamSetup:Clone()
local CamFocus = CamSetup.Torso
C.Parent = game.Workspace
function LoadCam()
    local camera = game.workspace.CurrentCamera
    CamFocus.Parent = camera
    camera.CameraSubject = CamFocus
    camera.CameraType = ("Scriptable")  
end 

local RemoteCamera = game.ReplicatedStorage.RemoteCam:InvokeServer()
LoadCam()
local camera = game.workspace.CurrentCamera

game:GetService("RunService").RenderStepped:connect(function()
  camera.CameraSubject = C
  C.Humanoid:MoveTo(player.Character.Chest.Position + Vector3.new(0,0,10))
  camera.CoordinateFrame = CFrame.new(CamFocus.Position)  
       * CFrame.Angles(0, CamFocus.Rotation.Y, 0) 
  local angle = CamFocus.Rotation.Y + math.rad(1)
end)    

Answer this question