Help with main menu system

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I’m trying to make a menu where you choose between 2 teams, you get to a play menu, then you select a class, and then you spawn.

  2. What is the issue? The issue is the loading screen I use to transition from screen to screen won’t go away, even after setting its frame visibility to false.

  3. What solutions have you tried so far? Friends, devhub, scriptinghelpers.

ui.MainPlayFrame.Play.MouseButton1Click:Connect(function()
	
	ui.LoadingScreen.Visible = true
	if value.Value == "noteam" then
		print("Player has no team!")
	elseif value.Value == "DE" then
		print("DE")
		ui.ClassSelect2.Visible = true

	elseif value.Value == "UK" then
		print("UK")

		ui.ClassSelect1.Visible = true

	else print("Huh")
		
	ui.LoadingScreen.Loading:TweenPosition(
		UDim2.new(0.3, -3,0.2, 0),
		Enum.EasingDirection.In,
		Enum.EasingStyle.Elastic,
		4,
		false,
		invis
	)
	ui.MainPlayFrame.Visible = false
	
	
	
	end
end)

The invis() function:

 function invis()
	 ui.LoadingScreen.Visible = false
	
end

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

If the loading screen is one time thing cant you do ui.LoadingScreen:Destroy?? or am I not understanding you correctly? if you can, can you post an image or gif of the issue the issue is not understood exactly, is the loadingscreen interfering with button pressing for team changing or?

If you are referring to the ui in startergui, it wont work.

Example : game.startergui.ui.frame.visible = false (will not work)
Because the ui is replicated to the player.

Try this isntead : game.player.localplayer.playergui.ui.frame.visible = false

(I hope u understand, english isn’t my native language)

Hey. Since UI in the StarterGui is replicated to the client when the game starts, it’s best you make your variable pointing towards the player’s GUI.

If the localscript you are using is inside the GUI, it might be best to make this your variable:
local ui = script.Parent
However, if it is placed differently it is best to make your variable as such:
local ui = game:GetService("Players").LocalPlayer.PlayerGui.UI

If you’d like a more fancy approach to your function as well with the invisibility, it’d also be quite optimal to use TweenService (which is optional)

local TweenService = game:GetService("TweenService")
TweenService:Create(ui.LoadingScreen, TweenInfo.new(0.5), {Transparency = 1}):Play()

Anyhow, I hope this helps you.

Theres 3 different sections of the menu and I want to use it 3 times to hide the transition.

The UI variable is set to script.Parent and its cloned into the players PlayerGui upon player join.