Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Expected "End" to close?

Asked by 4 years ago
Edited 4 years ago

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 <eof>; did you forget to close 'do' at line 38?

0
Does it show a line in the script thats the error? PhantomBrix 40 — 4y
0
If you click on the error what line line does it take you to? PhantomBrix 40 — 4y
0
It just takes we to the bottom of the script, where the end is JustTwiggy 5 — 4y
0
Can you provide the full script? ImTrev 344 — 4y
View all comments (3 more)
0
I agree, something is wrong at line 38 (according to the error message) but we can't see it. PhantomBrix 40 — 4y
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. PhantomBrix 40 — 4y
0
I put a end there and there is still a problem JustTwiggy 5 — 4y

2 answers

Log in to vote
0
Answered by
ImTrev 344 Moderation Voter
4 years ago
Edited 4 years ago

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
0
How dare you answer before me Official_DuckyYT 55 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

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

Answer this question