Turn Camera to Scriptable and Move it with CFrame

 I want to move the camera from one brick to the other, with a relatively fast camera move.
 I click on the brick, and nothing happens.
I looked for a solution and I found one that didn't work.

I would like to make the camera face the front of the brick, and move somewhat fast towards the next camera brick.

function onClicked(plr)
	local camera = game.Workspace.Camera
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CFrame = game.Workspace.PaddockCam.CFrame
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Is this running from a Local script or Server script?

have you set the camera subject to the object tho?

server script. and I haven’t set the camera subject

@FerbZides

function onClicked(plr)
	local camera = game.Workspace.CurrentCamera
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CameraSubject = game.Workspace.PaddockCam
	camera.CFrame = game.Workspace.PaddockCam.CFrame
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

1 Like

Run this on a localscript. The server can’t tell when a specific player clicks on something unless you fire a remote event. This should work fine on a localscript (i think).

thanks! I will try this in a sec

Button code:

function onClicked(plr)
   game.ReplicatedStorage.BasicMoveToPaddock:FireServer()
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Replicated storage code:

game.ReplicatedStorage.BasicMoveToPaddock.OnServerEvent:Connect(function()
	local camera = game.Workspace.CurrentCamera
	camera.CameraType = Enum.CameraType.Scriptable
	camera.CameraSubject = game.Workspace.PaddockCam
	camera.CFrame = game.Workspace.PaddockCam.CFrame
end)

The server can’t move your client’s camera. Each player has their own. A LocalScript also won’t run if it’s a child of a Part/non-character Model in the workspace.

2 Likes

Camera is supposed to be handled by local server. Thats because every player might have different camera angle

oh, thanks for the help guys! after school ill test this out

ok, i came up with an idea. what if I made the camera go to a certain brick, and then move that brick instead of moving the camera?