Hi, I am new to programming on Roblox. I am having an issue where my play button doesn’t remove the entire main menu and reset the camera back to default. It will grateful if anyone is able to help me with this issue:
local menu = game.StarterGui.MenuGui
local camera = game.Workspace.CameraRig
local backgroundmusic = game.StarterGui.Music
local CameraRigScript = game.StarterGui.CameraRigScript
local StarterCam = game.StarterPlayer.StarterCharacterScripts.LocalScript
local GameMenu = game.Workspace.MainMenu
local Glasses = game.StarterGui.Glass
local PAKMenu = game.StarterGui.PAKTCGui
local logo = game.StarterGui.StudioLogo
local camFOV = game.StarterPlayer.StarterCharacterScripts.CamFOV
script.Parent.MouseButton1Click:Connect(function()
menu:Destroy()
print("MainMenu destroyed")
camera:Destroy()
print("CameraRig destroyed")
backgroundmusic:Destroy()
print("Music destroyed")
CameraRigScript:Destroy()
print("Camera Rig script destroyed")
StarterCam:Destroy()
print("StarterCam destroyed")
GameMenu:Destroy()
print("GameMenu Destroyed")
Glasses:Destroy()
print("Glasses destroyed")
PAKMenu:Destroy()
print("PAKMenu destroyed")
logo:Destroy()
print("Logo destroyed")
camFOV:Destroy()
print("CamFOV destroyed")
end)
Thanks for the GUI solution but another problem is the camera will not reset back to the player even when I click the playButton. Do you have any advice for that?
Just another question if you don’t mind but is there a way to also remove the mouse tracking camera script and also make the player be able to walk again? Right now that I have set the camera back to player and the playergui is turn off but the camera keep moving back to the same rotation when I try to rotate my player camera to different angle and the player won’t move too.