-- Buttons

local tutorialBackButton = tutorialGUI:WaitForChild("BackButton")
local exitButtonPlay = playGUI:WaitForChild("ExitButton")
local exitButtonTutorial = tutorialGUI:WaitForChild("ExitButton")

local pressTutorial = playGUI:WaitForChild("Tutorial")
local pressGame = playGUI:WaitForChild("PlayGame")



local function exit()
	tutorialGUI.Visible = false
	playGUI.Visible = false
end

local function openPlayGUI()
	tutorialGUI.Visible = false
	playGUI.Visible = true
end

local function openTutorialGUI()
	tutorialGUI.Visible = true
	playGUI.Visible = false
end

local function triggerNewGame()
	-- call the remote event to fire the bindable event
	ClientTriggerGame:FireServer()
	exit()
end


exitButtonPlay.MouseButton1Click:Connect(exit)
exitButtonTutorial.MouseButton1Click:Connect(exit)
tutorialBackButton.MouseButton1Click:Connect(openPlayGUI)

pressGame.MouseButton1Click:Connect(triggerNewGame)
pressTutorial.MouseButton1Click:Connect(openTutorialGUI)

proximityPlay.Triggered:Connect(openPlayGUI)
toggleRideHUD.OnClientEvent:Connect(exit)
