Help my loading screen isn't working

Hello so I have this script here from a loading screen that it works it works perfectly fine BUT here is the issue every time the player dies or resets the gui pops up even after it says :Destroy()
if there is a solution to this please let me know and also yes the print does work the “Done” and “hi”

here is the script


yo

local GUI = script.Parent

local Background = GUI:WaitForChild(“Background”)

local Bar = Background:WaitForChild(“Bar”)

local Filler = Bar:WaitForChild(“Filler”)

local Percentage = Bar:WaitForChild(“Percentage”)

wait(2)

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)

for i = 1, 100 do

wait(0.04)

Percentage.Text = i…"%"

local Formula = i/100

Filler:TweenSize(UDim2.new(Formula, 0, 1, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Linear, 0.1, true)

if i == 34 or i == 69 or i == 99 then

wait(0.04)

end

end

local Tween = game.TweenService:Create(GUI.Fade, TweenInfo.new(

1.5,

Enum.EasingStyle.Linear,

Enum.EasingDirection.Out), {[“BackgroundTransparency”] = 0})

Tween:Play()

Tween.Completed:wait()

GUI.Background.Visible = false

wait(1)

Tween2 = game.TweenService:Create(GUI.Fade, TweenInfo.new(1.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {[“BackgroundTransparency”] = 1})

Tween2:Play()

Tween2.Completed:wait()

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true)

wait(1)

print(“hi”)

script.Disabled = true

script.Parent:Destroy()

print(“done”)

1 Like

Is the loading screen UI inside starter GUI?

It’s in starter gui (charcters)

I think I know why even after you have destroyed it when the player dies/respawns. The reason is I believe is due to every time someone respawns the contents of starter gui empeys as stated in the starter gui docs.

StarterGui (roblox.com)

so is there a solution to the issue?

Is only put ResetOnSpawn (u find on ScreenGui) to false

2 Likes

Like @rtvr56565 said on the screengui it should have an option inside the properties section to disable it. I really suggest you read the documentations as it explains things like that well and does not take a while at all.

Simply go to the gui’s properties and set ResetOnSpawn to false, as @rtvr56565 said,

true but then it doesn’t work in general

but it turns it off like when a player joins

Yes it will, turn on “Enabled” and “Visible” and it should work.

it still doesn’t work like it still pops up even after the resetonspawn is turned off

You have startergui locally as well so could you not just disable it there or would that not work?

like wdym disable the whole startergui?

No. In a local script could you not do game.StarterGui.[PUT THE WAY TO THE UI].ResetOnSpawn = false?

I already tried that idk what to do at this point this is so annoying

finally it’s working it’s fixed