Hi. As the title states, I'm trying to make my 3D main menu go away after hitting the play button. When the player respawns the main menu reappears. I've tried to make it set the camera to your player on respawn if you've already clicked it using "var" which you can see. But it won't work. If the player respawns it should set the camera to be locked on the player right? Only the bottom parts starting from "PlayClicker" should matter. I'm not even sure why the camera resets back to the main menu, I never tell it to except for the top.
game:GetService("StarterGui"):SetCore("TopbarEnabled", false) local var local MainMenu = game.Workspace.Rooms.MainMenu local cam = workspace.CurrentCamera local TweenService = game:GetService("TweenService") cam.CameraType = Enum.CameraType.Scriptable local player = game:GetService("Players").LocalPlayer local pgui = player.PlayerGui local gui = pgui:WaitForChild("FadeBlack") cam.CFrame = workspace.Rooms.MainMenu.LobbyCameraPart.CFrame repeat wait() until game:IsLoaded() wait(1.3) workspace.MainMenu:Play() TweenService:Create(workspace.MainMenu, TweenInfo.new(1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Volume = 0.5}):Play() local HelpClicker = MainMenu.HelpButton.ClickDetector HelpClicker.MouseClick:Connect(function() TweenService:Create(cam, TweenInfo.new(2.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {CFrame = MainMenu.HelpCameraPart.CFrame}):Play() end) local BackHelpClicker = MainMenu.BackHelp.ClickDetector BackHelpClicker.MouseClick:Connect(function() TweenService:Create(cam, TweenInfo.new(2.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {CFrame = MainMenu.LobbyCameraPart.CFrame}):Play() end) local PlayClicker = MainMenu.PlayButton.ClickDetector PlayClicker.MouseClick:Connect(function() local var = true local tweenInfo = TweenInfo.new(1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0) TweenService:Create(gui.Frame, tweenInfo, {BackgroundTransparency = 0}):Play() TweenService:Create(workspace.MainMenu, TweenInfo.new(1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0), {Volume = 0}):Play() wait(1.5) workspace.MainMenu:Stop() cam.CameraType = Enum.CameraType.Custom cam.CameraSubject = player.Character:WaitForChild("Humanoid") player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-31.85, 20.5, -119.9)) game:GetService("StarterGui"):SetCore("TopbarEnabled", true) wait(1) TweenService:Create(gui.Frame, tweenInfo, {BackgroundTransparency = 1}):Play() end) player.CharacterAdded:Connect(function() if var then cam.CameraType = Enum.CameraType.Custom cam.CameraSubject = player.Character:WaitForChild("Humanoid") game:GetService("StarterGui"):SetCore("TopbarEnabled", true) player.Character.HumanoidRootPart.CFrame = CFrame.new(Vector3.new(-31.85, 20.5, -119.9)) end end)