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

Why isn't my loading GUI destroying itself?

For context, here's the code of my LocalScript that is in game.ReplicatedFirst and has a GUI named Load contained inside.

game.ReplicatedFirst:RemoveDefaultLoadingScreen()

local PlrGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
PlrGui:SetTopbarTransparency(0)

local ScreenLoading = script.Load:Clone()
ScreenLoading.Parent = PlrGui

repeat wait() until game:IsLoaded()
wait(2)

local TakeAway = 0

repeat
	wait(.01)
	TakeAway = TakeAway + 25
	ScreenLoading.Frame.TextLabel.TextColor3 = Color3.fromRGB(255 - TakeAway, 255 	TakeAway, 255 - TakeAway)
until ScreenLoading.Frame.TextLabel.TextColor3 == Color3.fromRGB(0,0,0)
TakeAway = 0

ScreenLoading:Destroy()

For some reason, the GUI won't delete itself, and I have no idea why. Also, feel free to improve this code. I'm really bad at coding.

1 answer

First of all, don't say you're bad at scripting. Everyone is good, there are only inexperienced people. Second, I think this might be your error:

ScreenLoading.Frame.TextLabel.TextColor3 = Color3.fromRGB(255 - TakeAway, 255   TakeAway, 255 - TakeAway)

For the G value, you forgot to add a - sign. Here's the fixed version:

game.ReplicatedFirst:RemoveDefaultLoadingScreen()

local PlrGui = game.Players.LocalPlayer:WaitForChild("PlayerGui")
PlrGui:SetTopbarTransparency(0)

local ScreenLoading = script.Load:Clone()
ScreenLoading.Parent = PlrGui

repeat wait() until game:IsLoaded()
wait(2)

local TakeAway = 0

repeat
    wait(.01)
    TakeAway = TakeAway + 25
    ScreenLoading.Frame.TextLabel.TextColor3 = Color3.fromRGB(255 - TakeAway, 255 - TakeAway, 255 - TakeAway)
until ScreenLoading.Frame.TextLabel.TextColor3 == Color3.fromRGB(0,0,0)
TakeAway = 0

ScreenLoading:Destroy()

I hope this works!

If it doesn't, tell me if you are getting any errors in the output.

Thanks!

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