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)