Camera for my menu

Hi, so I am making a menu for my game where the background is just the camera.

local cc = workspace.CurrentCamera
local pc = workspace:WaitForChild("PlayCam")

task.wait(0.001)

cc.CameraType = Enum.CameraType.Scriptable

cc.CFrame = pc.CFrame

local function playerEntered()
	cc.CFrame = pc.CFrame
end

game.Players.PlayerAdded:Connect(function()
	playerEntered()
end)

local plr = game.Players.LocalPlayer



script.Parent.Frame.Play.MouseButton1Down:Connect(function()
	local character = game.Workspace:WaitForChild(plr.Name)
	if character then
		wait(1)
		cc.CFrame = character.Head.CFrame
		cc.CameraType = Enum.CameraType.Custom
		
	end
end)

When it sets the camera back to the head:

script.Parent.Frame.Play.MouseButton1Down:Connect(function()
	local character = game.Workspace:WaitForChild(plr.Name)
	if character then
		wait(1)
		cc.CFrame = character.Head.CFrame
		cc.CameraType = Enum.CameraType.Custom
		
	end
end)

It just sets it to the place the play was before they clicked play.

1 Like

You don’t have to set the CFrame of the camera back to the head it will get back itself

remove the : cc.CFrame = character.Head.CFrame

1 Like