Loading Screen keeps re-appearing upon death

I have a loading screen that I only want to show up once (when a player joins), however, it keeps re-appearing when a player dies/resets. Anybody have any tips or advice on how I could only make the loading screen appear once when joining the game?

Script:

local holder = script.Parent.Holder
script.Parent.Enabled = true
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
script.IntroMusic:Play()

local function start()
    local numAssets = #game:GetDescendants()
    local assetsLoaded = 0

    local startTime = tick()
    repeat
        local elapsedTime = tick() - startTime
        local progress = math.min(elapsedTime / 6, 1)
        holder.BarFrame.Bar.Size = UDim2.new(progress, 0, 1, 0)
        wait()
    until elapsedTime >= 6

    holder:TweenPosition(UDim2.new(0.5, 0, -1.5, 0), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 1)

    local volume = 1
    while volume > 0 do
        volume = math.max(volume - 0.1, 0)
        script.IntroMusic.Volume = volume
        wait(1)
    end

    script.IntroMusic:Stop()
end

start()

Is the local script inside ReplicatedFirst?

No, it’s inside of the ScreenGUI for the loading screen
image

I recommend putting the screenGui in ReplicatedStorage and the local script in ReplicatedFirst. Then clone the gui and parent it to the PlayerGui inside the local script along with the other necessary UI animations in the code.

Will try it out now, thanks alot

1 Like

There is an option on the ScreenGui called ResetOnSpawn, make that false (unchecked). That will make it only run one time when the game starts.

1 Like

Can’t believe it was that simple, hours of irritation and script adjustments all because of one setting I didn’t even know existed :sweat_smile:. Anyways, thanks alot this worked.

2 Likes