I have a loading screen script in ReplicatedFirst
While loading in the other GUI’s stay there and i tried making them invisible but i cant
I have tried enabling the DefaultUI but ive realized that the script has to be a child, ive tried remote events but it kept doing the loading screen when the user dies and respawns. ive also tried making it visible after some time with a local script but it also kept happening after you respawn when dying
This is the script iu have
local player = game:GetService("Players")
local RF = game:GetService("ReplicatedFirst")
local ContentP = game:GetService("ContentProvider")
local TS = game:GetService("TweenService")
local SG = game:GetService("StarterGui")
local DU = SG:WaitForChild("DefaultUI")
RF:RemoveDefaultLoadingScreen()
local plr = player.LocalPlayer
local plrGUI = plr:WaitForChild("PlayerGui")
local LoadingScreen = script:WaitForChild("LoadingScreen"):Clone()
LoadingScreen.Parent = plrGUI
local frame = LoadingScreen:WaitForChild("Frame")
local Text = frame:WaitForChild("TextLabel")
local bar = frame:WaitForChild("LoadingBar"):WaitForChild("Bar")
wait(2)
local assets = game:GetChildren()
wait(2)
for index, asset in pairs(assets) do
wait()
Text.Text = "Loading\n " .. asset.Name .. "..."
ContentP:PreloadAsync({asset})
local progress = index / #assets
bar.Size = UDim2.new (progress, 0, 1, 0)
end
wait()
Text.Text = "Loading Complete"
bar.Size = UDim2.new (1, 0, 1, 0)
if bar.Size == UDim2.new (1, 0, 1, 0) then
end
task.wait(2)
LoadingScreen:Destroy()
If you have a solution for it please tell me, thank you.