Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

{Solved by Asker} Loading screen shows after player resets?

I have this loading screen code here:


local plr = game.Players.LocalPlayer
local ts = game:GetService("TweenService")
game:GetService('Players').LocalPlayer:WaitForChild('PlayerGui'):SetTopbarTransparency(1)
IgnoreGuiInset = true
local overlay = script.Parent.ScrollingFrame
wait()
	

ts:Create(overlay,TweenInfo.new(.5,Enum.EasingStyle.Quint),{Size = UDim2.new(1,0,.2,0)}):Play()

wait(2.5)

repeat wait() until plr.Character

ts:Create(overlay,TweenInfo.new(.9,Enum.EasingStyle.Quint),{Size = UDim2.new(1,0,.35,0)}):Play()

wait(1)

repeat wait() until workspace
repeat wait() until game.Players

ts:Create(overlay,TweenInfo.new(.16,Enum.EasingStyle.Quint),{Size = UDim2.new(1,0,.6,0)}):Play()

wait(1)
repeat wait() until game:GetService("DataStoreService")

ts:Create(overlay,TweenInfo.new(.32,Enum.EasingStyle.Quint),{Size = UDim2.new(1,0,.8,0)}):Play()

wait(1)
repeat wait() until game:GetService("Lighting")
repeat wait() until game:GetService("GamePassService")
repeat wait() until game:GetService("MarketplaceService")

ts:Create(overlay,TweenInfo.new(.5,Enum.EasingStyle.Quint),{Size = UDim2.new(1,0,.91,0)}):Play()
wait(2)
--ts:Create(script.Parent.Checkmark,TweenInfo.new(.32,Enum.EasingStyle.Linear),{Size = UDim2.new(1,0,.8,0)}):Play()
ts:Create(script.Parent,TweenInfo.new(2.5,Enum.EasingStyle.Elastic),{Position = UDim2.new(0,0,1.15,0)}):Play()

script:Destroy()

The loading screen its self is working perfectly fine, but the problem is that when a player resets, the loading screen shows again.

I don't want it showing again, so I added a script:Destroy() at the end, but it isn't working.

How do I fix this problem?

Any help is appreciated.

1 answer

Try destroying the Gui locally in the StarterGui folder. So, instead of destroying the script (which doesnt have to do anything with the gui itself), destroy the gui in the startergui folder locally. The code shall be something like this:

--in the same localscript as the code you made
local startergui = game.StarterGui
local myclone = startergui:FindFirstChild(script.Parent.Name) --adjust this as you need to
if myclone ~= nil then
	myclone:Destroy()
else
	print("Something went wrong.")
end

This shall do (i guess)

2 comments

0

The Loading screen still shows after I reset :/

0

Hmm... Wait for another answer then. I have no idea.

This discussion is preserved as it was. New answers, comments, and votes are closed.