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
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”)


