Folder cloned immediately removed after game is loaded

So I have a folder in replicated first I’m busy with making a package for the preload folder it contains a pre loading screen where the business logo activated with the game is displayed for 5 seconds depending on game I’d it will enable the loading screen and after that a fake load bar (all loading screens are fake) well when I try to clone the folder to the playergui it will be added but if the game is loaded it immediately being removed

local folder = script.Parent.Preload
local plr = game.Players.LocalPlayer

local RunService = game:GetService("RunService")

game:GetService("ReplicatedFirst"):RemoveDefaultLoadingScreen()

if not RunService:IsStudio() then
    -- handle loading screen visibility
end

local preload = folder:Clone()
preload.Parent = plr.PlayerGui

If I manually disable enabled the script it works but it can’t in the actual game

If when you manually disable then enable the script it works, how about making another script to disable and enable that script if possible?

Otherwise you can try to debug it using print()

When the game loads I think it sort of clears the cache of the player elements to create a fresh template to clone the elements in the starter folders. So maybe try cloning the folder only after the game loads with

repeat wait() until game:IsLoaded()

This folder need to contain also a fake loading screen

It doesn’t work in studio where I need to test the Topbar to work it have a menu button what now break the Topbar

local folder = script.Parent:WaitForChild("preload")
print(folder)
if not folder then
	task.wait()
end
local player = game:GetService("Players").LocalPlayer

local RunService = game:GetService("RunService")

game:GetService('ReplicatedFirst'):RemoveDefaultLoadingScreen()
repeat task.wait() until game:IsLoaded()

if not RunService:IsStudio() then
	-- enable loadingscreens will be based on game prob
end

if player then
	local preload = folder:Clone()
preload.Parent = player.PlayerGui
print(preload.Parent)
end
``` somtimes and in studio it being removed from playergui inmidialtly

I found out what was the problem with the method it cloned on the client but sometimes not and not in studio cuz I used load charater