CharacterAutoLoads, a Gui and a play button do not work

Hello! So I am making a sword fighting game and I am making a main menu. The menu works with CharacterAutoLoads turned off because I have a script for it. Though whenever I press the play button, the gui never disables itself. It just clones itself every time I press play.

StarterPlayerScripts LocalScript:

local player = game:GetService("Players").LocalPlayer

for _, gui in pairs(game.StarterGui:GetChildren()) do
local ui = gui:Clone()
ui.Parent = player.PlayerGui
end

Then we would need to see the code that runs when the button is pressed.

The Gui is already put into the PlayerGui. You do not have to clone it and put it into the PlayerGui.

local play = script.Parent

local fade = play.Parent.Parent.Fade

play.MouseButton1Click:Connect(function(player)	
	fade.Parent.Main.Visible = false
	game.Lighting.Blur.Enabled = false
	
	game:GetService("ReplicatedStorage").RemoteEvent:FireServer(player)

wait(1)
	
	fade.Parent.Enabled = false
end)

and here is the event script

local Event = game:GetService("ReplicatedStorage").RemoteEvent

Event.OnServerEvent:Connect(function(player)
	player:LoadCharacter()
	
	player.PlayerGui.MainMenu:Destroy()
end)

Whenever you have CharacterAutoLoads off, I’m pretty sure you need to clone it into the player gui (that’s what I’ve seen on the devforum)

Well, I think what happens is, you Destroy the old Ui, but the Character loads in and clones it?

Does your Ui has reset on spawn enabled?

1 Like

You need to store the GUIs somewhere else.
Running LoadCharacter also automatically loads the GUIs from StarterGui.

Yeah, would I need to disable it?

Yeah, you can try that. I still think that the Gui is being made again after character is loaded… Hm, let me try something.

1 Like

Disabling ResetOnSpawn works. Thank you!

Oh, I believe the destroy never worked, because you cloned on the client and tried to destroy on server.

1 Like

What message should I mark as a solution?

You can mark this as the solution if you want.

1 Like

Would I need to change anything with my scripts? Or can I just keep ResetOnSpawn turned off

Should just be reset on spawn turned off. Let me know if you run into any more issues.

1 Like

Alright gotcha. Thank you again!