Problem with :GetChildren on main menu

Sup, I am in currently in a rush trying to finish my Friend’s horror game and I need help.
I am making a way for the players to start the game when everyone joins the lobby
I do it by putting the player in a folder called “Choosing” and when they select a chapter/map they get moved to another folder for said chapter. And when everyone joins the lobby for the chapter it leaves the "Choosing’’ folder with no children.

The problem is that the players get moved to a different folder but the stuff that is supposto happen after the ‘‘Choosing’’ folder remains with no children doesn’t happen.
The text doesn’t change, the sounds don’t play. Everything remains still.

I tried to fix it by adding a part to the folder and changing the transparency of the part so instead of
:Choosing:GetChildren() == 0 it was Choosing.Part.Tansparency = 1

It didn’t work aswell. There were no errors in the output.
This is the script I used for the function (Sorry about not having enough variables):

local pb = game.Workspace.MainMenuFolder.Main.MainMenuUI.MainFrame.Buttons.Play
local Main = game.Workspace.MainMenuFolder.Main.MainMenuUI.MainFrame.UILobby
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

humanoid.WalkSpeed = 0

wait (.001)

player.Character.Parent = game.Workspace.PlayerFolder.Lobby.Choosing

local Sounds = game.Workspace.MainMenuFolder.SFX

pb.MouseButton1Click:Connect(function()
	Main.Visible = true
	Sounds.Click:Play()
end)

local Close = Main.Close

Close.MouseButton1Click:Connect(function()
	Sounds.Click:Play()
	Main.Visible = false
end)

pb.MouseEnter:Connect(function()
	Sounds.UIenter:Play()
	pb.TextSize = 40
	pb.BackgroundTransparency = 0.9
end)

pb.MouseLeave:Connect(function()
	pb.TextSize = 32
	pb.BackgroundTransparency = 1	
end)

Main.Image.MouseEnter:Connect(function()
	Main.Background.BorderColor3 = Color3.fromRGB(12, 81, 0)
	Sounds.UIenter:Play()
end)

Main.Image.MouseButton1Click:Connect(function()
	game.Workspace.MainMenuFolder.Main.MainMenuUI.MainFrame.UILobby.MainLobby.Image.Visible = true
	game.Workspace.MainMenuFolder.Main.MainMenuUI.MainFrame.UILobby.MainLobby.Waiting.Visible = true
	game.Workspace.MainMenuFolder.Main.MainMenuUI.MainFrame.UILobby.MainLobby.Map.Visible = true
	Main.Background.Visible = false
	Main.Image.Visible = false
	Sounds.Click:Play()
	wait(.5)
	player.Character.Parent = game.Workspace.PlayerFolder.Lobby.C1
	local Choosing = game.Workspace.PlayerFolder.Lobby.Choosing
	if #Choosing:GetChildren() == 0 then
		wait(1)
		game.Workspace.MainMenuFolder.Main.MainMenuUI.MainFrame.UILobby.MainLobby.Waiting.Text = "Starting..."
		Sounds.Press:Play()
		wait(5)
		Sounds["Fallout radio static "].Playing = false
		Sounds["Dark Zone"].Playing = false
		game.Lighting.ColorCorrection.Brightness = -10
		wait(3)
		game.Lighting.ColorCorrection.Brightness = 0
		game.StarterPlayer.Cough:Play()
		game.Workspace.SFX.Ambience.Playing = true
		game.Workspace.Dave.Dave.Body["Spider Footsteps 3 (SFX)"].Playing = true
		game.Workspace.Dave.Dave.Body.Growl.Playing = true
		humanoid.WalkSpeed = 8
		wait(1)
		game.StarterPlayer.Breath.Playing = true
	end
end)

Main.Image.MouseLeave:Connect(function()
	Main.Background.BorderColor3 = Color3.fromRGB(21, 157, 0)
end)

Anything will help.
BY THE WAY THE MAIN MENU IS A SURFACE UI

if Main.Image is an imagelabel then you cant detect clicks
if it still doesnt work try putting prints everywhere and see where stuff goes wrong

I kid you not, but the thing started working the moment I added the print at the start. I have no idea why but it just started working like a charm.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.