Hello guys I am trying to make the camera focus on this brick with this script but it is not focusing on the brick I am not sure why is that. When the client clicks on the button the camera just goes and focuses on a random spot on the map. The Brick that the camera is supposed to be focusing on is called CameraForOutfit. Also I am trying to make it so when the client clicks on a gui button the camera goes back to normal as it was before the client clicked the button. But I am not sure were to start with it. thanks in return.
local RunService = game:GetService("RunService") local camera = workspace.CurrentCamera local offset = Vector3.new(5,5,5) function updateCam() camera.CFrame = CFrame.new(workspace.CameraForOutfit.Position + offset,workspace.CameraForOutfit.Position) end script.Parent.MouseButton1Click:Connect(function() script.Parent.Parent:Destroy() -- Clears Gui camera.CameraType = Enum.CameraType.Scriptable camera.CameraSubject = workspace.CameraForOutfit RunService:BindToRenderStep("CameraForOutfit",1,updateCam) end)
Try using the Camera.Focus Function. Here's an article about it that might be to help. That's what I used when I had a similar goal to yours.
https://www.robloxdev.com/api-reference/property/Camera/Focus
This is a previous answer I gave somebody else.