I'm trying to make the camera follow a part around but I have a problem, when I type in

cam.Focus = CameraPart

It says

Players.longjohnnn.PlayerGui.ScreenGui.Start Frame.Play.Starter Script:19: bad argument #3 (CFrame expected, got Object)

But when I type in

cam.Focus = CameraPart.CFrame

It says

attempt to call a boolean value.

Here is the whole script

local Play = script.Parent
Play.MouseButton1Up:Connect(function()
	local StartFrame = script.Parent.Parent
	local Settings = script.Parent:FindFirstAncestor("Settings")
	spawn(StartFrame:TweenPosition(
		UDim2.new (0.999, 0, -0.125, 0),
		"Out",
		"Back",
		1,
		false
		))
local TempCar = game.Workspace:WaitForChild("TempCar")
local CameraPart2 = TempCar.CameraPart2
local cam = game.Workspace.CurrentCamera
local CameraPart = TempCar.CameraPart
cam.CameraType = "Scriptable"
local Runservice = game:GetService("RunService")
	Runservice.Heartbeat:Connect(function(step)
		cam.Focus = CameraPart.CFrame
	end)
end)

4 comments

0

when it says attempt to call a Boolean value, is that error also on line 19?

0

Why not cam.CFrame = CameraPart.CFrame

0

It doesn't show where it is

0

Okay I did cam.CFrame and now it's working! thank you