Lock camera in coordinate?

I need to make a camera look out of the front surface of a brick when I touch a block.

  1. What do you want to achieve? I need to make the camera look out of a brick.

  2. What is the issue? Include screenshots / videos if possible! I want the camera to be looking out of that brick but no matter what I try nothing works…

  3. What solutions have you tried so far? I did look on the developer hub and everything I try, I can always control the camera. I have tried triggering a local script with a remote event but that didn’t work and I looked around on the forums and did find a topic similar to what I need but It didn’t help…

function onTouch(hit)
	local player = hit.Parent:findFirstChild("Torso")
	local brick = script.Parent
	if player then
		game.ReplicatedStorage.HouseCamTrigger:FireClient()
		player.CFrame = CFrame.new(Vector3.new(-68.9, -82.3, 100.5))
	end
end

script.Parent.Touched:connect(onTouch)

that was a normal script not local or module

The coordinates of the brick I want the camera to be in/at are -72.4, -75.121, 125.029

If you need more information please say.

1 Like

You will need to execute some code on the client (with a LocalScript) in order to modify the Camera. You can access the LocalPlayer’s Camera object with the line:

local cam = workspace.CurrentCamera

Then, you need to take one additional step before setting the Camera’s location:

cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = CFrame.new(vector3Origin, vector3LookAt)

You can replace vector3Origin with the Vector3 you would like the camera to be positioned at, and you can replace vector3LookAt with the Vector3 you would like the camera to be looking at. If you ever wish to return the camera back to the Character, you can simply change the CameraType property back to Enum.CameraType.Custom --This Enum indicates to Roblox’s core camera scripts to do their thing.

1 Like

I did this and this is what happened:

1 Like

Oh sorry im dumb i used a - instead of an =
sorry!

May want to hold the control key and spin that mouse wheel to zoom in bit (; Hope this helped!

1 Like

yah… but thank you! It works!