How do i fix this script that makes the camera move to a part?

when i use the script it just makes my camera look at the part, but i dont want it to do that. i want it to be looking from the part.
specifically looking straight down

local cam = game.Workspace:WaitForChild("Camera")

repeat cam.CameraType = Enum.CameraType.Scriptable wait() until cam.CameraType == Enum.CameraType.Scriptable
cam.CameraType = Enum.CameraType.Custom

local Focal = game.Workspace:WaitForChild("Focal")

while task.wait() do

	local Cal1 = Focal.Position.X + .1
	local Cal2 = Focal.Position.z - .1

	Focal.Position = Vector3.new(Cal1, 135, Cal2)

	cam.CFrame = Focal.CFrame
end

just to clarify, the part moving DOES work, its just the part of the script that moves the camera to the moving part does not work

still does the same thing
char limit

Okay, I’ll write a script that puts the camera at Focal looking down (you must be making a top-down game)

local cam = game.Workspace:WaitForChild("Camera")

repeat cam.CameraType = Enum.CameraType.Scriptable wait() until cam.CameraType == Enum.CameraType.Scriptable
cam.CameraType = Enum.CameraType.Custom

local Focal = game.Workspace:WaitForChild("Focal")

while task.wait() do
        cam.CFrame = CFrame.new(Focal.Position, Focal.Position - Vector3.yAxis)
end

Try this

not a topdown game lol… its for a loading screen background

its litrally just a bunch of randomly generated patterns

1 Like

kinda works, but it locks my camera down amd doesnt move it to the part

Yes, you wanted the camera to be looking down, right?

yeah but its not following the part

Set your camera type to scriptable.

it is
char limitttttttttttttttttttttttt

Try this code, tell me if it works :smile: (i just removed the line where you made camera custom)

i already tried that, im sorry.

Try it again, also is the focal point actually moving? Just a question.

yes it is moving
char limitttt

yeah this is just matching my cameras rotation to the part, not moving it to the part

local cam = game.Workspace.CurrentCamera

repeat cam.CameraType = Enum.CameraType.Scriptable wait() until cam.CameraType == Enum.CameraType.Scriptable

local Focal = game.Workspace:WaitForChild("Focal")

while task.wait() do
	cam.CFrame = CFrame.new(Focal.Position, Focal.Position - Vector3.yAxis)
end

Try this.

you already told me to try that and it didnt work

Try everything together. Try this script out, I changed it to .CurrentCamera.

its till just locking my camera to look down, still not moving it to the part

When you play test it in studio, and check the camera properties, does it say scriptable?

Also, are you sure the part is just not moving?