Disabling character auto loads doesn't work with guis problem

Fine, I will explain it.

CharacterAutoLoads does not spawn the character when they join the game.

If the character is not auto spawned, they will not have any gui from StarterGui put into their PlayerGui.

Their PlayerGui instance will exist, but will not have the default gui for the game.

You can find more information on this by researching on this issue.

1 Like

Works I assume, the OP will mark this as solution.

This is a good example, but I don’t recommend this since the StarterGui does not instantly load, good example nonetheless.

Yes, I agree it’s not the best. I prefer dumping all my UI into ReplicatedStorage, but I didn’t want to force OP to change up their game.

Didn’t work for some reason I made some changes also and it still won’t work which is really weird

Is there any error? I need more information to debug.

Did you understand my explanation? I will assume yes.

No errors or anything :/

You can use the :WaitForChild function for this.

Example:

StarterGui:WaitForChild(gui)
StarterGui:WaitForChild(other gui)

Disclaimer: this is weird since it will individually wait for these but I believe it works fine.

You could use the ContentProvider service to preload the Guis first.

I have dealt with something like this before and it does not work. The game doesn’t consider the gui objects existing until the PC loads it in, which isn’t instant. Weirdly scripts can run before Roblox is done making the games existing objects.

What I mean is like being able to identify the gui.

Weird because it prints after the wait for child but does nothing after that

Here is the script that i modified from @MrMoled

game:GetService("StarterGui"):WaitForChild("MenuSelect")

print("yoink")

local players = game:GetService("Players")
local localPlayerGui = players.LocalPlayer

task.wait(1)

players.PlayerAdded:Connect(function(player)
	for _, ui in pairs(game.StarterGui:GetChildren()) do
		local u = ui:Clone()
		u.Parent = localPlayerGui
	end
end)

OOOOOOOH I see what you did wrong, you have to put it in the players Player.PlayerGui silly.

That’s your problem.

The service allows every single instance as to preload the function.

I mean the instance isn’t inside the game yet, which also isn’t identifiable if it doesn’t exist :slight_smile:

LOL- How did I not catch thatttt

Still won’t work tho D:

That’s literally the same thing as replicating 3D stuffs such as parts in the game to the client. It takes time to load, Preload function was designed to force the client to load these instance first. Guis are also the same thing.

As I said, try using ContentProvider service to preload the Guis.

Does the MeneSelect load and nothing else or nothing?

Apparently I’ve been working on server side too much. The problem was that the function would never get fired. Since when the client player loads into the game the server player has already been added. And since this is a local script, we don’t need to be checking when the player gets added. A revised script:

local player = game.Players.LocalPlayer
for _, ui in pairs(game.StarterGui:GetChildren()) do
	local u = ui:Clone()
	u.Parent = player.PlayerGui
end
3 Likes