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

Expected "End" to close?

It's a shame I'm already back asking question but does anyone know how to fix this

Full Script

---------------
-- Constants--
----------------

local DivisionsFrame = script.Parent.Parent.Divisions
local UniformFrame = script.Parent.Parent.Uniforms
local MorphDir = game.ReplicatedStorage.Morphs
local Libs = game.ReplicatedStorage.Libs
-----------------
--Main Code---
-----------------

for i, v in pairs (MorphDir:GetChildren () ) do
	local Button = Instance.new("TextButton")
	Button.Size = UDim2.new(1, 0, 0, 50)
	Button.BackgroundTransparency = 1
	Button.Font = "GothamBlack"
	Button.TextSize = 25
	Button.TextXAlignment = "Center"
	Button.TextColor3 = Color3.fromRGB(255, 255, 255)
	
	Button.Text = v.Name
	Button.Parent = DivisionsFrame
	
	Button.MouseButton1Click:connect(function ()
		for i, v2 in pairs (UniformFrame:GetChildren () ) do
			if v2.ClassName  == "Text Button"  then
				v2:Destroy()
			end
		end
		end)
	for  i, v3 in pairs (v:GetChildren () ) do
			for i, v3 in pairs (MorphDir:GetChildren () ) do
			local Button = Instance.new("TextButton")
			Button2.Size = UDim2.new(1, 0, 0, 50)
			Button2.BackgroundTransparency = 1
			Button2.Font = "GothamBlack"
			Button2.TextSize = 25
			Button2.TextXAlignment = "Center"
			Button2.TextColor3 = Color3.fromRGB(255, 255, 255) 
			
			Button2.Text = v3.Name
				Button2.Parent = DivisionsFrame 
		end
		end




--It's the end above thats the problem, I think...

Edit- Heres the output

Players.JustTwiggy.PlayerGui.MorphSelection.Scripts.LocalScript:54: Expected 'end' (to close 'do' at line 18), got ; did you forget to close 'do' at line 38?

7 comments

0

Does it show a line in the script thats the error?

0

If you click on the error what line line does it take you to?

0

It just takes we to the bottom of the script, where the end is

0

Can you provide the full script?

0

I agree, something is wrong at line 38 (according to the error message) but we can't see it.

0

I assume you haven't closed a for loop that started at line 38, try putting an end at the end of said for loop.

0

I put a end there and there is still a problem

2 answers

With everything and fixed indentations this is what is there. If this is not working as intended please let me know and we can further debug.

---------------
-- Constants--
----------------

local DivisionsFrame = script.Parent.Parent.Divisions
local UniformFrame = script.Parent.Parent.Uniforms
local MorphDir = game.ReplicatedStorage.Morphs
local Libs = game.ReplicatedStorage.Libs
-----------------
--Main Code---
-----------------

for i, v in pairs(MorphDir:GetChildren () ) do
    local Button = Instance.new("TextButton")
    Button.Size = UDim2.new(1, 0, 0, 50)
    Button.BackgroundTransparency = 1
    Button.Font = "GothamBlack"
    Button.TextSize = 25
    Button.TextXAlignment = "Center"
    Button.TextColor3 = Color3.fromRGB(255, 255, 255)

    Button.Text = v.Name
    Button.Parent = DivisionsFrame

    Button.MouseButton1Click:connect(function()
        for i, v2 in pairs(UniformFrame:GetChildren()) do
            if v2.ClassName  == "Text Button"  then
                v2:Destroy()
            end
        end
    end)

    for  i, v3 in pairs(v:GetChildren()) do
        for i, v3 in pairs(MorphDir:GetChildren()) do
            local Button = Instance.new("TextButton")
            Button.Size = UDim2.new(1, 0, 0, 50)
            Button.BackgroundTransparency = 1
            Button.Font = "GothamBlack"
            Button.TextSize = 25
            Button.TextXAlignment = "Center"
            Button.TextColor3 = Color3.fromRGB(255, 255, 255) 

            Button.Text = v3.Name
            Button.Parent = DivisionsFrame 
        end
    end
end

1 comment

0

How dare you answer before me

The problem is that you forgot an end at the first for loop, so it should be:

---------------
-- Constants--
----------------

local DivisionsFrame = script.Parent.Parent.Divisions
local UniformFrame = script.Parent.Parent.Uniforms
local MorphDir = game.ReplicatedStorage.Morphs
local Libs = game.ReplicatedStorage.Libs
-----------------
--Main Code---
-----------------

for i, v in pairs (MorphDir:GetChildren () ) do
    local Button = Instance.new("TextButton")
    Button.Size = UDim2.new(1, 0, 0, 50)
    Button.BackgroundTransparency = 1
    Button.Font = "GothamBlack"
    Button.TextSize = 25
    Button.TextXAlignment = "Center"
    Button.TextColor3 = Color3.fromRGB(255, 255, 255)

    Button.Text = v.Name
    Button.Parent = DivisionsFrame

    Button.MouseButton1Click:connect(function ()
        for i, v2 in pairs (UniformFrame:GetChildren () ) do
            if v2.ClassName  == "Text Button"  then
                v2:Destroy()
            end
        end
        end)
    for  i, v3 in pairs (v:GetChildren () ) do
            for i, v3 in pairs (MorphDir:GetChildren () ) do
            local Button2 = Instance.new("TextButton")
            Button2.Size = UDim2.new(1, 0, 0, 50)
            Button2.BackgroundTransparency = 1
            Button2.Font = "GothamBlack"
            Button2.TextSize = 25
            Button2.TextXAlignment = "Center"
            Button2.TextColor3 = Color3.fromRGB(255, 255, 255) 

            Button2.Text = v3.Name
                Button2.Parent = DivisionsFrame 
        end
        end
end

Also fixed another error which you had, and put Button and then tried to define it as Button2

-Ducky

Developer

Youtuber

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