Done Button Not Working

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? I want to make a done button that makes the gui’s visibility false.

  2. What is the issue? I scripted it, but it does not work.

  3. What solutions have you tried so far? I have watched multiple youtube videos and have looked at multiple forum posts.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

Here is my script

local BarProgress = 0
local Background = script.Parent.Parent

while wait() do
	BarProgress = BarProgress + 0.5
	script.Parent.Size =, 0, 0.1, 0)
	script.Parent.Parent.LoadingText.Text = ("Loading... "..math.floor(BarProgress*2).."%")
	if BarProgress == 50 then
		while wait() do
			script.Parent.BackgroundTransparency = script.Parent.BackgroundTransparency + 0.08
			script.Parent.Parent.BarBackground.BackgroundTransparency = script.Parent.Parent.BarBackground.BackgroundTransparency + 0.08
			script.Parent.Parent.LoadingText.TextTransparency = script.Parent.Parent.LoadingText.TextTransparency + 0.08
			if script.Parent.BackgroundTransparency >= 1 then
				script.Parent.Parent.AfterText.Visible = true
				script.Parent.Parent.Done.Visible = true
				script.Parent.Parent.TextButton.Visible = true

	Background.Visible = false


The loop inside of a loop is kind of pointless and unneeded. When you first enter the loop, it is going to do what you told it to do before you went into another loop. It will then go into the loop infinitely, and never do anything you told it to do in the first loop(except the second loop).

You only really need the first loop, and not the second one.

Also, are you getting any errors in the output?

The loop is not my problem, it is the done button which is the script at the very end. And no, there are no errors.

It might be the problem, but not the one I originally talked about.

You should have the MouseButton1Click function before the while true loop, because the loop keeps repeating and it never gets to connecting the MouseButton1Click function.