Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Camera Script Not Focusing On Brick?

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)

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.