How do I make the camera revert back to normal after a player presses play?

I want to make a camera tween for my main menu. When I click the play button, it’s supposed to stop the tween in the background and reset back to the player camera. This is the part that breaks. I’ve tried changing the camera enum value to fixed, changing the camera to the player, and so on. None of these have worked.
https://streamable.com/ntagut
Code:

--Camera
local player = game.Players.LocalPlayer
local cutsceneTime = 25
local character = player.Character or player.CharacterAdded:Wait()

local camTweenInfo = TweenInfo.new(
	cutsceneTime, 
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.Out,
	120, 
	true,
	5
)
function camTween()
		character:WaitForChild("Humanoid")
		local tween = tweenService:Create(cam, camTweenInfo, {CFrame = camPart2.CFrame})
		tween:Play()
end

--Main
cam.CameraType = Enum.CameraType.Scriptable
cam.CFrame = camPart.CFrame
wait(3)
tweenDestroyLoadScrn:Play()
wait(0.5)
main.Visible = true
tweenPlayBtn:Play()
tweenGameIcon:Play()

PlayBtn.MouseEnter:Connect(function()
	tweenEnterPlayBtn:Play()
end)
PlayBtn.MouseLeave:Connect(function()
	tweenLeavePlayBtn:Play()
end)


PlayBtn.MouseButton1Click:Connect(function()
	tweenStartMain:Play()
	gameIcon:Destroy()
	PlayBtn:Destroy()
	wait(2)
	tweenDoneMain:Play()
	cam.CameraType = Enum.CameraType.Custom
	cam.CameraSubject = player
	wait(2)
	loadingScrn:Destroy()
	main:Destroy()
	
end)

print("Hi")

camTween()
--wait(cutsceneTime)

This thread might help you.

2 Likes

Neither of these worked for me

1 Like

I think this should be set to player.Character not just player.

1 Like

It didn’t work for me, it did the same thing

1 Like

Probably you need to change the camera CFrame.

1 Like

No, the same issue has occured again

Replace this line:

cam.CameraSubject = player 

With this:

cam.CameraSubject = player.Humanoid
1 Like

Make sure you cancel the camera tween, store the tween somewhere in your code and in your PlayBtn click function, call Tween:Pause() or Tween:Cancel()

2 Likes