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

Returning a part's position for a camera?

Asked by 8 years ago

So, I have 2 parts, LookAt and CamPos. CamPos is the new camera's position and LookAt is where the camera should point. I tried to make it so you could move the model anywhere.

local cam = game.Workspace.CurrentCamera
local dummy = game.Workspace.Chest
local CamPos = dummy.Cam
local LookAt = dummy.Meh
while wait(.5) do
    if script:WaitForChild("Enabled").Value == true then
        print("If")
        while script:WaitForChild("Enabled").Value == true and wait() do
            cam.CoordinateFrame=
            CFrame.new(Vector3.new(CamPos.Vector3.x, CamPos.Vector3.y, CamPos.Vector3.z), --CamPos
                        Vector3.new(LookAt.Vector3.x, LookAt.Vector3.y, LookAt.Vector3.z)) --LookAt
            cam.CameraType = "Scriptable"
        end
    else
        print("Else")
        cam.CameraSubject = game.Players.LocalPlayer.Character.Humanoid
        cam.CameraType = "Custom"   
    end
end

Answer this question