Problem with GUI script

I Typed this script below and it came out with an error. I will say the error below as well.

local loadingtext = script.parent.ScreenGui.Frame.Loading

local play = script.Parent.ScreenGui.Frame.Play

local title = script.Parent.ScreenGui.Frame.Title

local play1 = script.Parent.ScreenGui.Frame.Play1

local credits = script.Parent.ScreenGui.Frame.Credits

local dismem = script.Parent.ScreenGui.Frame.Distant

local lb1 = script.Parent.ScreenGui.Frame.LB1

local lb2 = script.Parent.ScreenGui.Frame.LB2

local loading1 = script.Parent.ScreenGui.Frame.Loading1

loading1.Visible = false

lb1.Visible = false

lb2.Visible = false

lb2.Position = UDim2.new(-2, 0,0.427, 0)

lb1.Position = UDim2.new(2, 0,0.499, 0)

dismem.Visible = false

play1.Visible = false

credits.Visible = false

local function loadingblocks()

local loadingnum1 = 0

lb1.Visible = true

lb2.Visible = true

lb1:TweenPosition(UDim2.new(0.479, 0,0.499, 0), "Out", "Back")

lb2:TweenPosition(UDim2.new(0.479, 0,0.427, 0), "Out", "Back")

wait(1)

lb1:TweenPosition(UDim2.new(0.518, 0,0.499, 0), "Out", "Back")

repeat

wait(1)

lb1:TweenPosition(UDim2.new(0.518, 0,0.499, 0), "Out", "Back")

wait(1)

lb1:TweenPosition(UDim2.new(0.518, 0,0.354, 0), "Out", "Back")

wait(1)

lb1:TweenPosition(UDim2.new(0.44, 0,0.354, 0), "Out", "Back")

wait(1)

lb1:TweenPosition(UDim2.new(0.44, 0,0.499, 0), "Out", "Back")

loadingnum1 = loadingnum1 + 1

until loadingnum1 == 6

if loadingnum1 == 6 then

lb1.Visible = false

lb2.Visible = false

loading1.Visible = false

wait(2)

script.Parent.ScreenGui.Frame.BackgroundColor3 = Color3.fromHSV(0, 0, 0)

wait(5)

loading1.Text = ""

loading1.TextColor3 = Color3.fromHSV(0, 0, 1)

loading1.Text = "W"

wait(0.1)

loading1.Text = "W-"

wait(2)

loading1.Text = "W- "

wait(0.1)

loading1.Text = "W- W"

wait(0.1)

loading1.Text = "W- Wh"

wait(0.1)

loading1.Text = "W- Whe"

wait(0.1)

loading1.Text = "W- Wher"

wait(0.1)

loading1.Text = "W- Where"

wait(0.1)

loading1.Text = "W- Where "

wait(0.1)

loading1.Text = "W- Where a"

wait(0.1)

loading1.Text = "W- Where am"

wait(0.1)

loading1.Text = "W- Where am "

wait(0.1)

loading1.Text = "W- Where am I"

wait(0.1)

loading1.Text = "W- Where am I?"

wait(0.5)

loading1.Text = "W- Where am I??"

wait(0.5)

loading1.Text = "W- Where am I???"

end

wait()

pcall(function()

local starterGui = game:GetService('StarterGui')

starterGui:SetCore("TopbarEnabled", false)

end)

loadingtext.Text = "Loading..."

local plrs = game:GetService("Players")

local plr = plrs.LocalPlayer

local text1 = "Quick! "..plr.Name.."! We need you!"

local text2 = "You are a true star defender, ".. plr.Name

local text3 = "You've got a mission, ".. plr.Name

local textnumber = math.random(1,3)

title.Position = UDim2.new(0.286, 0,1, 0)

play.Position = UDim2.new(0.371, 0,1.5, 0)

loadingtext.Position = UDim2.new(0.371, 0,2, 0)

wait(5)

title:TweenPosition(UDim2.new(0.286, 0,0.12, 0), "Out", "Back")

wait(2)

loadingtext:TweenPosition(UDim2.new(0.371, 0,0.5, 0), "Out", "Back")

wait(2)

loadingtext.Text = "Loading."

wait(0.5)

loadingtext.Text = "Loading.."

wait(0.5)

loadingtext.Text = "Loading..."

wait(0.5)

loadingtext.Text = "Loading."

wait(0.5)

loadingtext.Text = "Loading.."

wait(0.5)

loadingtext.Text = "Loading..."

wait(0.5)

loadingtext.Text = "Loading."

wait(0.5)

loadingtext.Text = "Loading.."

wait(0.5)

loadingtext.Text = "Loading..."

wait(0.5)

loadingtext.Text = "Loading."

wait(1)

loadingtext.Text = "Calculating Stars... 1%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 2%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 3%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 5%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 7%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 9%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 10%"

wait(0.4)

loadingtext.Text = "Calculating Stars... 11%"

wait(0.4)

loadingtext.Text = "Calculating Stars... 14%"

wait(0.4)

loadingtext.Text = "Calculating Stars... 16%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 17%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 18%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 21%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 25%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 30%"

wait(3)

loadingtext.Text = "Calculating Stars... 36%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 40%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 41%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 42%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 46%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 49%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 50%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 51%"

wait(0.3)

loadingtext.Text = "Calculating Stars... 56%"

wait(0.3)

loadingtext.Text = "Calculating Stars... 63%"

wait(0.3)

loadingtext.Text = "Calculating Stars... 64%"

wait(0.5)

loadingtext.Text = "Calculating Stars... 70%"

wait(0.5)

loadingtext.Text = "Calculating Stars... 79%"

wait(0.5)

loadingtext.Text = "Calculating Stars... 85%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 86%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 87%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 88%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 89%"

wait(0.1)

loadingtext.Text = "Calculating Stars... 90%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 91%"

wait(0.2)

loadingtext.Text = "Calculating Stars... 96%"

wait(0.5)

loadingtext.Text = "Calculating Stars... 99%"

wait(3)

loadingtext.Text = "Calculating Stars... Done!"

wait(1.1)

play:TweenPosition(UDim2.new(0.371, 0,0.8, 0), "Out", "Back")

if textnumber == 1 then

loadingtext.Text = text1

else

if textnumber == 2 then

loadingtext.Text = text2

else

if textnumber == 3 then

loadingtext.Text = text3

end

end

end

play.MouseButton1Click:Connect(function()

play.Visible = false

title.Visible = false

loadingtext.Visible = false

script.Parent.ScreenGui.Frame.BackgroundColor3 = Color3.fromHSV(0, 0, 0.588235)

dismem.Visible = true

play1.Visible = true

credits.Visible = true

end)

dismem.MouseButton1Click:Connect(function()

play1.Visible = false

credits.Visible = false

dismem.Visible = false

loading1.Visible = true

loadingblocks()

end)

Error was: Players.devhelpaccount.PlayerGui.LocalScript:232: Expected 'end' (to close 'function' at line 19), got <eof>; did you forget to close 'function' at line 226? - Studio - LocalScript:232

I looked through the whole script and searched it up on google. Any ideas?

You’re probably missing one more end, hard to tell because your code formatting is horrible, you should try to learn how to make it better.

Also, instead of making this script so extremely long, you should use a for loop, your code will be much easier to modify and 80% shorter.

Can you help me with that please? Sorry that I am not a genius at this like you must be.

Could u show line 19? Of ur localscript?

Around line 400 you can find this segment:

if textnumber == 1 then

    loadingtext.Text = text1

    else

        if textnumber == 2 then

            loadingtext.Text = text2

        else

            if textnumber == 3 then

                loadingtext.Text = text3
            end -- <-- you forgot this end

        end

    end

end

Where you forgot one “end” (the last one). Because of your code formatting. Formatting your code goes a long way. I think when you learn to format code properly, you won’t have similar issues coming back anymore.

local loadingtext = script.parent.ScreenGui.Frame.Loading
local play = script.Parent.ScreenGui.Frame.Play
local title = script.Parent.ScreenGui.Frame.Title
local play1 = script.Parent.ScreenGui.Frame.Play1
local credits = script.Parent.ScreenGui.Frame.Credits
local dismem = script.Parent.ScreenGui.Frame.Distant
local lb1 = script.Parent.ScreenGui.Frame.LB1
local lb2 = script.Parent.ScreenGui.Frame.LB2
local loading1 = script.Parent.ScreenGui.Frame.Loading1
loading1.Visible = false
lb1.Visible = false
lb2.Visible = false
lb2.Position = UDim2.new(-2, 0,0.427, 0)
lb1.Position = UDim2.new(2, 0,0.499, 0)
dismem.Visible = false
play1.Visible = false
credits.Visible = false

local function loadingblocks()
	local loadingnum1 = 0
	lb1.Visible = true
	lb2.Visible = true
	lb1:TweenPosition(UDim2.new(0.479, 0,0.499, 0), "Out", "Back")
	lb2:TweenPosition(UDim2.new(0.479, 0,0.427, 0), "Out", "Back")
	wait(1)
	lb1:TweenPosition(UDim2.new(0.518, 0,0.499, 0), "Out", "Back")
	repeat
		wait(1)
		lb1:TweenPosition(UDim2.new(0.518, 0,0.499, 0), "Out", "Back")
		wait(1)
		lb1:TweenPosition(UDim2.new(0.518, 0,0.354, 0), "Out", "Back")
		wait(1)
		lb1:TweenPosition(UDim2.new(0.44, 0,0.354, 0), "Out", "Back")
		wait(1)
		lb1:TweenPosition(UDim2.new(0.44, 0,0.499, 0), "Out", "Back")
		loadingnum1 = loadingnum1 + 1
	until loadingnum1 == 6
	if loadingnum1 == 6 then
		lb1.Visible = false
		lb2.Visible = false
		loading1.Visible = false
		wait(2)
		script.Parent.ScreenGui.Frame.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
		wait(5)
		loading1.Text = ""
		loading1.TextColor3 = Color3.fromHSV(0, 0, 1)
		loading1.Text = "W"
		wait(0.1)
		loading1.Text = "W-"
		wait(2)
		loading1.Text = "W- "
		wait(0.1)
		loading1.Text = "W- W"
		wait(0.1)
		loading1.Text = "W- Wh"
		wait(0.1)
		loading1.Text = "W- Whe"
		wait(0.1)
		loading1.Text = "W- Wher"
		wait(0.1)
		loading1.Text = "W- Where"
		wait(0.1)
		loading1.Text = "W- Where "
		wait(0.1)
		loading1.Text = "W- Where a"
		wait(0.1)
		loading1.Text = "W- Where am"
		wait(0.1)
		loading1.Text = "W- Where am "
		wait(0.1)
		loading1.Text = "W- Where am I"
		wait(0.1)
		loading1.Text = "W- Where am I?"
		wait(0.5)
		loading1.Text = "W- Where am I??"
		wait(0.5)
		loading1.Text = "W- Where am I???"
	end
	wait()
	pcall(function()
		local starterGui = game:GetService('StarterGui')
		starterGui:SetCore("TopbarEnabled", false)
	end)
	loadingtext.Text = "Loading..."
	local plrs = game:GetService("Players")
	local plr = plrs.LocalPlayer
	local text1 = "Quick! "..plr.Name.."! We need you!"
	local text2 = "You are a true star defender, ".. plr.Name
	local text3 = "You've got a mission, ".. plr.Name
	local textnumber = math.random(1,3)
	title.Position = UDim2.new(0.286, 0,1, 0)
	play.Position = UDim2.new(0.371, 0,1.5, 0)
	loadingtext.Position = UDim2.new(0.371, 0,2, 0)
	wait(5)
	title:TweenPosition(UDim2.new(0.286, 0,0.12, 0), "Out", "Back")
	wait(2)
	loadingtext:TweenPosition(UDim2.new(0.371, 0,0.5, 0), "Out", "Back")
	wait(2)
	loadingtext.Text = "Loading."
	wait(0.5)
	loadingtext.Text = "Loading.."
	wait(0.5)
	loadingtext.Text = "Loading..."
	wait(0.5)
	loadingtext.Text = "Loading."
	wait(0.5)
	loadingtext.Text = "Loading.."
	wait(0.5)
	loadingtext.Text = "Loading..."
	wait(0.5)
	loadingtext.Text = "Loading."
	wait(0.5)
	loadingtext.Text = "Loading.."
	wait(0.5)
	loadingtext.Text = "Loading..."
	wait(0.5)
	loadingtext.Text = "Loading."
	wait(1)
	loadingtext.Text = "Calculating Stars... 1%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 2%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 3%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 5%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 7%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 9%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 10%"
	wait(0.4)
	loadingtext.Text = "Calculating Stars... 11%"
	wait(0.4)
	loadingtext.Text = "Calculating Stars... 14%"
	wait(0.4)
	loadingtext.Text = "Calculating Stars... 16%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 17%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 18%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 21%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 25%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 30%"
	wait(3)
	loadingtext.Text = "Calculating Stars... 36%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 40%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 41%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 42%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 46%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 49%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 50%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 51%"
	wait(0.3)
	loadingtext.Text = "Calculating Stars... 56%"
	wait(0.3)
	loadingtext.Text = "Calculating Stars... 63%"
	wait(0.3)
	loadingtext.Text = "Calculating Stars... 64%"
	wait(0.5)
	loadingtext.Text = "Calculating Stars... 70%"
	wait(0.5)
	loadingtext.Text = "Calculating Stars... 79%"
	wait(0.5)
	loadingtext.Text = "Calculating Stars... 85%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 86%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 87%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 88%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 89%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 90%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 91%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 96%"
	wait(0.5)
	loadingtext.Text = "Calculating Stars... 99%"
	wait(3)
	loadingtext.Text = "Calculating Stars... Done!"
	wait(1.1)
	play:TweenPosition(UDim2.new(0.371, 0,0.8, 0), "Out", "Back")
	if textnumber == 1 then
		loadingtext.Text = text1
	elseif textnumber == 2 then
		loadingtext.Text = text2
	elseif textnumber == 3 then
		loadingtext.Text = text3
	end
	play.MouseButton1Click:Connect(function()
		play.Visible = false
		title.Visible = false
		loadingtext.Visible = false
		script.Parent.ScreenGui.Frame.BackgroundColor3 = Color3.fromHSV(0, 0, 0.588235)
		dismem.Visible = true
		play1.Visible = true
		credits.Visible = true
	end)
	dismem.MouseButton1Click:Connect(function()
		play1.Visible = false
		credits.Visible = false
		dismem.Visible = false
		loading1.Visible = true
	end)
end

loadingblocks()

I believe you just forget an end statement at the end of the script for the outer function definition.

	if textnumber == 1 then
		loadingtext.Text = text1
	elseif textnumber == 2 then
		loadingtext.Text = text2
	elseif textnumber == 3 then
		loadingtext.Text = text3
	end

Also those conditionals should be converted into a conditional chain, like in the above.

When I inserted the script onto here, there were these weird spaces in between each line.

It only goes to line 232…

The entire script I’ve provided above should work however you’ll need to actually add a line which calls the function after the function has been defined.

loadingblocks()

I’ve added that for you (it should be outside of the function).

Oh well, if you scroll to the very down of your script and then scroll up again until you see the code chunk I posted, it’s there. It’s not very far from the end. It would be something like line 180 in your script.

With the fixed formatting it’s around line 195.

image

Yes you’re right, @DevHelpAccount try with that

Where should I put end?

(Is it here?)

The output warn you on line 19, check there

Line 19 just has a function on that line.

Yes, the output is saying you that you did not close the function at line 19, close it

where should I close it? At which line?

Idk, it depends what you want to do with the function…

local loadingtext = script.parent.ScreenGui.Frame.Loading
local play = script.Parent.ScreenGui.Frame.Play
local title = script.Parent.ScreenGui.Frame.Title
local play1 = script.Parent.ScreenGui.Frame.Play1
local credits = script.Parent.ScreenGui.Frame.Credits
local dismem = script.Parent.ScreenGui.Frame.Distant
local lb1 = script.Parent.ScreenGui.Frame.LB1
local lb2 = script.Parent.ScreenGui.Frame.LB2
local loading1 = script.Parent.ScreenGui.Frame.Loading1
loading1.Visible = false
lb1.Visible = false
lb2.Visible = false
lb2.Position = UDim2.new(-2, 0,0.427, 0)
lb1.Position = UDim2.new(2, 0,0.499, 0)
dismem.Visible = false
play1.Visible = false
credits.Visible = false

local function loadingblocks()
	local loadingnum1 = 0
	lb1.Visible = true
	lb2.Visible = true
	lb1:TweenPosition(UDim2.new(0.479, 0,0.499, 0), "Out", "Back")
	lb2:TweenPosition(UDim2.new(0.479, 0,0.427, 0), "Out", "Back")
	wait(1)
	lb1:TweenPosition(UDim2.new(0.518, 0,0.499, 0), "Out", "Back")
	repeat
		wait(1)
		lb1:TweenPosition(UDim2.new(0.518, 0,0.499, 0), "Out", "Back")
		wait(1)
		lb1:TweenPosition(UDim2.new(0.518, 0,0.354, 0), "Out", "Back")
		wait(1)
		lb1:TweenPosition(UDim2.new(0.44, 0,0.354, 0), "Out", "Back")
		wait(1)
		lb1:TweenPosition(UDim2.new(0.44, 0,0.499, 0), "Out", "Back")
		loadingnum1 = loadingnum1 + 1
	until loadingnum1 == 6
	if loadingnum1 == 6 then
		lb1.Visible = false
		lb2.Visible = false
		loading1.Visible = false
		wait(2)
		script.Parent.ScreenGui.Frame.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
		wait(5)
		loading1.Text = ""
		loading1.TextColor3 = Color3.fromHSV(0, 0, 1)
		loading1.Text = "W"
		wait(0.1)
		loading1.Text = "W-"
		wait(2)
		loading1.Text = "W- "
		wait(0.1)
		loading1.Text = "W- W"
		wait(0.1)
		loading1.Text = "W- Wh"
		wait(0.1)
		loading1.Text = "W- Whe"
		wait(0.1)
		loading1.Text = "W- Wher"
		wait(0.1)
		loading1.Text = "W- Where"
		wait(0.1)
		loading1.Text = "W- Where "
		wait(0.1)
		loading1.Text = "W- Where a"
		wait(0.1)
		loading1.Text = "W- Where am"
		wait(0.1)
		loading1.Text = "W- Where am "
		wait(0.1)
		loading1.Text = "W- Where am I"
		wait(0.1)
		loading1.Text = "W- Where am I?"
		wait(0.5)
		loading1.Text = "W- Where am I??"
		wait(0.5)
		loading1.Text = "W- Where am I???"
	end
	wait()
	pcall(function()
		local starterGui = game:GetService('StarterGui')
		starterGui:SetCore("TopbarEnabled", false)
	end)
	loadingtext.Text = "Loading..."
	local plrs = game:GetService("Players")
	local plr = plrs.LocalPlayer
	local text1 = "Quick! "..plr.Name.."! We need you!"
	local text2 = "You are a true star defender, ".. plr.Name
	local text3 = "You've got a mission, ".. plr.Name
	local textnumber = math.random(1,3)
	title.Position = UDim2.new(0.286, 0,1, 0)
	play.Position = UDim2.new(0.371, 0,1.5, 0)
	loadingtext.Position = UDim2.new(0.371, 0,2, 0)
	wait(5)
	title:TweenPosition(UDim2.new(0.286, 0,0.12, 0), "Out", "Back")
	wait(2)
	loadingtext:TweenPosition(UDim2.new(0.371, 0,0.5, 0), "Out", "Back")
	wait(2)
	loadingtext.Text = "Loading."
	wait(0.5)
	loadingtext.Text = "Loading.."
	wait(0.5)
	loadingtext.Text = "Loading..."
	wait(0.5)
	loadingtext.Text = "Loading."
	wait(0.5)
	loadingtext.Text = "Loading.."
	wait(0.5)
	loadingtext.Text = "Loading..."
	wait(0.5)
	loadingtext.Text = "Loading."
	wait(0.5)
	loadingtext.Text = "Loading.."
	wait(0.5)
	loadingtext.Text = "Loading..."
	wait(0.5)
	loadingtext.Text = "Loading."
	wait(1)
	loadingtext.Text = "Calculating Stars... 1%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 2%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 3%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 5%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 7%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 9%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 10%"
	wait(0.4)
	loadingtext.Text = "Calculating Stars... 11%"
	wait(0.4)
	loadingtext.Text = "Calculating Stars... 14%"
	wait(0.4)
	loadingtext.Text = "Calculating Stars... 16%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 17%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 18%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 21%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 25%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 30%"
	wait(3)
	loadingtext.Text = "Calculating Stars... 36%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 40%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 41%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 42%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 46%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 49%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 50%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 51%"
	wait(0.3)
	loadingtext.Text = "Calculating Stars... 56%"
	wait(0.3)
	loadingtext.Text = "Calculating Stars... 63%"
	wait(0.3)
	loadingtext.Text = "Calculating Stars... 64%"
	wait(0.5)
	loadingtext.Text = "Calculating Stars... 70%"
	wait(0.5)
	loadingtext.Text = "Calculating Stars... 79%"
	wait(0.5)
	loadingtext.Text = "Calculating Stars... 85%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 86%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 87%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 88%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 89%"
	wait(0.1)
	loadingtext.Text = "Calculating Stars... 90%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 91%"
	wait(0.2)
	loadingtext.Text = "Calculating Stars... 96%"
	wait(0.5)
	loadingtext.Text = "Calculating Stars... 99%"
	wait(3)
	loadingtext.Text = "Calculating Stars... Done!"
	wait(1.1)
	play:TweenPosition(UDim2.new(0.371, 0,0.8, 0), "Out", "Back")
	if textnumber == 1 then
		loadingtext.Text = text1
	elseif textnumber == 2 then
		loadingtext.Text = text2
	elseif textnumber == 3 then
		loadingtext.Text = text3
	end
	play.MouseButton1Click:Connect(function()
		play.Visible = false
		title.Visible = false
		loadingtext.Visible = false
		script.Parent.ScreenGui.Frame.BackgroundColor3 = Color3.fromHSV(0, 0, 0.588235)
		dismem.Visible = true
		play1.Visible = true
		credits.Visible = true
	end)
	dismem.MouseButton1Click:Connect(function()
		play1.Visible = false
		credits.Visible = false
		dismem.Visible = false
		loading1.Visible = true
	end)
end

loadingblocks()

Yes, it should be right I think