首页 > 解决方案 > 这个错误是什么意思?我似乎无法让这段代码工作

问题描述

我试图让这个 lua 代码运行,但似乎无法让它工作。每当我运行它时,我都会收到这个错误,无论我编辑多少次,我似乎都无法避免。任何人都可以找到解决方案吗?我一直在网上搜索无济于事。这是我得到的错误

输入:58:eof 附近的意外符号

这是代码:

-- Made By Vincent


local ScreenGui = Instance.new("ScreenGui")
local Main = Instance.new("Frame")
local RoundedCorners = Instance.new("UICorner")
local BlackHoleGun = Instance.new("TextButton")
local UICorner = Instance.new("UICorner")
local GoldenPistol = Instance.new("TextButton")
local UICorner_2 = Instance.new("UICorner")
local CrazyFuturisticMinigun = Instance.new("TextButton")
local UICorner_3 = Instance.new("UICorner")
local BiochemicalBlaster = Instance.new("TextButton")
local UICorner_4 = Instance.new("UICorner")
local SpaceRifle = Instance.new("TextButton")
local UICorner_5 = Instance.new("UICorner")
local LavaPistol = Instance.new("TextButton")
local UICorner_6 = Instance.new("UICorner")
local Scar = Instance.new("TextButton")
local UICorner_7 = Instance.new("UICorner")
local RayGun = Instance.new("TextButton")
local UICorner_8 = Instance.new("UICorner")
local SniperRifle = Instance.new("TextButton")
local UICorner_9 = Instance.new("UICorner")

--Properties:

ScreenGui.Parent = game.CoreGui

Main.Name = "Main"
Main.Parent = ScreenGui
Main.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Main.Position = UDim2.new(0.383399218, 0, 0.121621616, 0)
Main.Size = UDim2.new(0, 426, 0, 211)
Main.Active = true
Main.Draggable = true

RoundedCorners.Name = "RoundedCorners"
RoundedCorners.Parent = Main

BlackHoleGun.Name = "Black Hole Gun"
BlackHoleGun.Parent = ScreenGui
BlackHoleGun.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
BlackHoleGun.Position = UDim2.new(0.393280655, 0, 0.136486486, 0)
BlackHoleGun.Size = UDim2.new(0, 121, 0, 49)
BlackHoleGun.Font = Enum.Font.GothamBold
BlackHoleGun.Text = "Black Hole Gun"
BlackHoleGun.TextColor3 = Color3.fromRGB(255, 219, 0)
BlackHoleGun.TextScaled = true
BlackHoleGun.TextSize = 14.000
BlackHoleGun.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
BlackHoleGun.TextWrapped = true
BlackHoleGun.MouseButton1Down:connect(function()
    local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

    local Arguments = {
        [1] = {
            [1] = {
                [1] = "Black Hole Gun"
            },
            [2] = {
                [1] = false
            }
        }
    }

    Remote:FireServer(unpack(Arguments))



    UICorner.Parent = BlackHoleGun
    

GoldenPistol.Name = "Golden Pistol"
GoldenPistol.Parent = ScreenGui
GoldenPistol.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
GoldenPistol.Position = UDim2.new(0.533596873, 0, 0.136486486, 0)
GoldenPistol.Size = UDim2.new(0, 121, 0, 49)
GoldenPistol.Font = Enum.Font.GothamBold
GoldenPistol.Text = "Golden Pistol"
GoldenPistol.TextColor3 = Color3.fromRGB(255, 219, 0)
GoldenPistol.TextScaled = true
GoldenPistol.TextSize = 14.000
GoldenPistol.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
    GoldenPistol.TextWrapped = true
    NAMEOFBUTTONHERE.MouseButton1Down:connect(function()
        local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

        local Arguments = {
            [1] = {
                [1] = {
                    [1] = "Golden Pistol"
                },
                [2] = {
                    [1] = false
                }
            }
        }

        Remote:FireServer(unpack(Arguments))



    end)

UICorner_2.Parent = GoldenPistol

CrazyFuturisticMinigun.Name = "Crazy Futuristic Minigun"
CrazyFuturisticMinigun.Parent = ScreenGui
CrazyFuturisticMinigun.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
CrazyFuturisticMinigun.Position = UDim2.new(0.673913062, 0, 0.136486486, 0)
CrazyFuturisticMinigun.Size = UDim2.new(0, 121, 0, 49)
CrazyFuturisticMinigun.Font = Enum.Font.GothamBold
CrazyFuturisticMinigun.Text = "Crazy Futuristic Minigun"
CrazyFuturisticMinigun.TextColor3 = Color3.fromRGB(255, 219, 0)
CrazyFuturisticMinigun.TextScaled = true
CrazyFuturisticMinigun.TextSize = 14.000
CrazyFuturisticMinigun.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
    CrazyFuturisticMinigun.TextWrapped = true
    NAMEOFBUTTONHERE.MouseButton1Down:connect(function()
        local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

        local Arguments = {
            [1] = {
                [1] = {
                    [1] = "Crazy Futuristic Minigun"
                },
                [2] = {
                    [1] = false
                }
            }
        }

        Remote:FireServer(unpack(Arguments))



    end)

UICorner_3.Parent = CrazyFuturisticMinigun

BiochemicalBlaster.Name = "Biochemical Blaster"
BiochemicalBlaster.Parent = ScreenGui
BiochemicalBlaster.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
BiochemicalBlaster.Position = UDim2.new(0.393280655, 0, 0.231081083, 0)
BiochemicalBlaster.Size = UDim2.new(0, 121, 0, 49)
BiochemicalBlaster.Font = Enum.Font.GothamBold
BiochemicalBlaster.Text = "Biochemical Blaster"
BiochemicalBlaster.TextColor3 = Color3.fromRGB(255, 219, 0)
BiochemicalBlaster.TextScaled = true
BiochemicalBlaster.TextSize = 14.000
BiochemicalBlaster.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
    BiochemicalBlaster.TextWrapped = true
    NAMEOFBUTTONHERE.MouseButton1Down:connect(function()
        local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

        local Arguments = {
            [1] = {
                [1] = {
                    [1] = "Biochemical Blaster"
                },
                [2] = {
                    [1] = false
                }
            }
        }

        Remote:FireServer(unpack(Arguments))
    end)

UICorner_4.Parent = BiochemicalBlaster

SpaceRifle.Name = "Space Rifle"
SpaceRifle.Parent = ScreenGui
SpaceRifle.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
SpaceRifle.Position = UDim2.new(0.533596873, 0, 0.231081083, 0)
SpaceRifle.Size = UDim2.new(0, 121, 0, 49)
SpaceRifle.Font = Enum.Font.GothamBold
SpaceRifle.Text = "Space Rifle"
SpaceRifle.TextColor3 = Color3.fromRGB(255, 219, 0)
SpaceRifle.TextScaled = true
SpaceRifle.TextSize = 14.000
SpaceRifle.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
    SpaceRifle.TextWrapped = true
    NAMEOFBUTTONHERE.MouseButton1Down:connect(function()
        local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

        local Arguments = {
            [1] = {
                [1] = {
                    [1] = "Space Rifle"
                },
                [2] = {
                    [1] = false
                }
            }
        }

        Remote:FireServer(unpack(Arguments))


    end)

UICorner_5.Parent = SpaceRifle

LavaPistol.Name = "Lava Pistol"
LavaPistol.Parent = ScreenGui
LavaPistol.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
LavaPistol.Position = UDim2.new(0.672924936, 0, 0.231081083, 0)
LavaPistol.Size = UDim2.new(0, 121, 0, 49)
LavaPistol.Font = Enum.Font.GothamBold
LavaPistol.Text = "Lava Pistol"
LavaPistol.TextColor3 = Color3.fromRGB(255, 219, 0)
LavaPistol.TextScaled = true
LavaPistol.TextSize = 14.000
LavaPistol.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
    LavaPistol.TextWrapped = true
    NAMEOFBUTTONHERE.MouseButton1Down:connect(function()
        local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

        local Arguments = {
            [1] = {
                [1] = {
                    [1] = "Lava Pistol"
                },
                [2] = {
                    [1] = false
                }
            }
        }

        Remote:FireServer(unpack(Arguments))


    end)

UICorner_6.Parent = LavaPistol

Scar.Name = "Scar"
Scar.Parent = ScreenGui
Scar.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
Scar.Position = UDim2.new(0.392292529, 0, 0.322972983, 0)
Scar.Size = UDim2.new(0, 121, 0, 49)
Scar.Font = Enum.Font.GothamBold
Scar.Text = "Scar"
Scar.TextColor3 = Color3.fromRGB(255, 219, 0)
Scar.TextScaled = true
Scar.TextSize = 14.000
Scar.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
    Scar.TextWrapped = true
    NAMEOFBUTTONHERE.MouseButton1Down:connect(function()
        local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

        local Arguments = {
            [1] = {
                [1] = {
                    [1] = "SCAR"
                },
                [2] = {
                    [1] = false
                }
            }
        }

        Remote:FireServer(unpack(Arguments))


    end)

UICorner_7.Parent = Scar

RayGun.Name = "Ray Gun"
RayGun.Parent = ScreenGui
RayGun.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
RayGun.Position = UDim2.new(0.533596873, 0, 0.322972983, 0)
RayGun.Size = UDim2.new(0, 121, 0, 49)
RayGun.Font = Enum.Font.GothamBold
RayGun.Text = "Ray Gun"
RayGun.TextColor3 = Color3.fromRGB(255, 219, 0)
RayGun.TextScaled = true
RayGun.TextSize = 14.000
RayGun.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
    RayGun.TextWrapped = true
    NAMEOFBUTTONHERE.MouseButton1Down:connect(function()
        local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

        local Arguments = {
            [1] = {
                [1] = {
                    [1] = "Ray Gun"
                },
                [2] = {
                    [1] = false
                }
            }
        }

        Remote:FireServer(unpack(Arguments))



    end)

UICorner_8.Parent = RayGun

SniperRifle.Name = "Sniper Rifle"
SniperRifle.Parent = ScreenGui
SniperRifle.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
SniperRifle.Position = UDim2.new(0.672924936, 0, 0.322972983, 0)
SniperRifle.Size = UDim2.new(0, 121, 0, 49)
SniperRifle.Font = Enum.Font.GothamBold
SniperRifle.Text = "Sniper Rifle"
SniperRifle.TextColor3 = Color3.fromRGB(255, 219, 0)
SniperRifle.TextScaled = true
SniperRifle.TextSize = 14.000
SniperRifle.TextStrokeColor3 = Color3.fromRGB(174, 38, 148)
    SniperRifle.TextWrapped = true
    NAMEOFBUTTONHERE.MouseButton1Down:connect(function()
        local Remote = game.Workspace.__THINGS.__REMOTES['weaponequipped']

        local Arguments = {
            [1] = {
                [1] = {
                    [1] = "Sniper Rifle"
                },
                [2] = {
                    [1] = false
                }
            }
        }

        Remote:FireServer(unpack(Arguments))



    end)

UICorner_9.Parent = SniperRifle

标签: lua

解决方案


随着时间的推移,您将学习如何快速找到此类错误。如果你不知道从哪里开始,有几种方法可以解决这个问题。

  1. 阅读代码并在脑海中检查缺少的内容(专业级)

  2. 从代码中删除语法正确的所有内容

    在您的示例中,您最终会BlackHoleGun.MouseButton1Down:connect(function()得到一个带有不完整函数定义的不完整函数调用。所以你知道你必须end在函数体的末尾加上 a 并且你需要 a)来关闭函数调用。

  3. 计算成对出现的东西(大多数编辑都可以这样做)。

    在您的示例中,您有 36 {, 36 }, 54 [, 54 ], 105 (, 104) 哎呀!-> 1)短!

    你有 8end秒 0 do+ 0 then+ 9 function-> 1end短!

    现在检查缺少这些东西的位置并添加它们。

避免此类错误的一个非常好的方法是让您的文本编辑器/ide 自动完成对。


推荐阅读