Camera not changing when player clicks play

Hey everyone! So today I was practicing some camera movement, So I have a rotating camera that goes 360 degrees in a while true loop because it’s apart of the menu, when I click play, the tween happens, but after 3 seconds it’s suppose to go custom, which I thought is when the player is aloud to move the camera around and it’s back at it’s players camera. I’m not having errors at all, I’m just not sure how I can make it is at the players POV. Here is my script…

local player = game.Players.LocalPlayer
local PlayerGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
local character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
character:WaitForChild("HumanoidRootPart").Anchored = true

local TweenService = game:GetService("TweenService")

repeat wait()
	   Camera.CameraType = Enum.CameraType.Scriptable
	until Camera.CameraType == Enum.CameraType.Scriptable 
Camera.CFrame = workspace.Camerapart.CFrame

local info = TweenInfo.new(20,Enum.EasingStyle.Sine,Enum.EasingDirection.Out)
local rotating = true

local MainMenu = PlayerGui.MainMenu

local PlayButton = MainMenu.TextButton

local newinfo = TweenInfo.new(0.5,Enum.EasingStyle.Quad,Enum.EasingDirection.Out,0,false,0)

PlayButton.MouseButton1Click:Connect(function()
	print("PlayButton Clicked! Now the Tween will play!")
	local goal = {};
	goal.Position = UDim2.new(-0.2, 0, 0.71, 0)
	TweenService:Create(PlayButton, newinfo, goal):Play()
	
	wait(3)
	print("Player Spawned!")
	character.HumanoidRootPart.Anchored = false
	character.HumanoidRootPart.CFrame = workspace.SpawnPart.CFrame
	
	Camera.CameraType = Enum.CameraType.Custom
    
	MainMenu:Destroy()
end)

while rotating do
	local cameraTween = TweenService:Create(Camera, info, {CFrame = Camera.CFrame * CFrame.fromEulerAnglesXYZ(0, 360, 0);})
	cameraTween:Play()
	local blur = Instance.new("BlurEffect")
	blur.Parent = workspace.CurrentCamera
	blur.Enabled = true
	blur.Size = 10
	wait(0.02)
end

If anyone knows how to fix this, please let me know! Thanks!!!

You forgot to set the CameraSubject to HumanoidRootPart, and you need to make it scriptable to do that change

How about you also wait for the character THEN run the script to change the camera. Which can be achieved this way in a local script

repeat wait() until game.Players.LocalPlayer

So I did that, but It doesn’t seem to work, my print works but the going to the Humanoid doesn’t work. It still stays in the camera that it is in. This is what I changed…

PlayButton.MouseButton1Click:Connect(function()
	print("PlayButton Clicked! Now the Tween will play!")
	local goal = {};
	goal.Position = UDim2.new(-0.2, 0, 0.71, 0)
	TweenService:Create(PlayButton, newinfo, goal):Play()
	
	wait(3)
	print("Player Spawned!")
	character.HumanoidRootPart.Anchored = false
	character.HumanoidRootPart.CFrame = workspace.SpawnPart.CFrame
	Camera.CameraType = Enum.CameraType.Scriptable
	
	if Camera and player.character then
		local humanoid = player.character:FindFirstChildOfClass("Humanoid")
		if humanoid then
			Camera.CameraSubject = humanoid
		end
	end
   
	MainMenu:Destroy()
end)

while rotating do
	local cameraTween = TweenService:Create(Camera, info, {CFrame = Camera.CFrame * CFrame.fromEulerAnglesXYZ(0, 360, 0);})
	cameraTween:Play()
	local blur = Instance.new("BlurEffect")
	blur.Parent = workspace.CurrentCamera
	blur.Enabled = true
	blur.Size = 10
	wait(0.02)
end

Ok, I found the problem, it was because the tween has to finish in order for it to go to the players camera, do you know how to make it so, when they click on it, it immediately goes to the players camera.