UI not showing sometimes

local Plr = game.Players.LocalPlayer

PlayerGui = Plr.PlayerGui or Plr:WaitForChild("PlayerGui")

wait()

for _, UI in pairs(game.StarterGui:GetChildren()) do
	local a = UI:Clone()
	a.Parent = PlayerGui
end

In ReplicatedFirst
20% of the time no UI shows up

Seems weird you are copying gui from StarterGui to PlayerGui from the client manually, what’s the use case

CharacterAutoLoads is off, so the UI doesn’t load automatically

I thought just as much, I can provide a better method for ya. First create a folder named UI inside ReplicatedStorage. After that, insert a script in ServerScriptService (or just use the Loader script if you are using a framework) and paste the following code inside it.

local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local StarterGui = game:GetService("StarterGui")
local UIFolder = ReplicatedStorage:WaitForChild("UI")

Players.PlayerAdded:Connect(function(player)
    for _, ui in StarterGui:GetChildren() do
        local clone = ui:Clone()
        clone.Parent = UIFolder
    end
end)

Then from a local script in StarterPlayerScripts, move the contents of that previously mentioned UI folder to playerGui

local PlayerGui = player:WaitForChild("PlayerGui")

for _, ui in StarterGui:GetChildren() do
    ui.Parent = UIFolder
end

Any idea what’s wrong with the current script tho?

Prolly cuz it’s in ReplicatedFirst, maybe the UI won’t have time to load in?