我的 'elseif' 语句出现了 BUG

   如果 message:sub(6, message:len()) == "%d+" then
        local a = message:find(" ")

        local hatId = message:sub(a + 1, message:len())

        local hat = game:GetService("InsertService"):LoadAsset(tonumber(hatId)):GetChildren()[1]
        hat.Parent = character
        print("添加帽子 " .. hatId .. " 到 " .. player.Name)
    elseif message:sub(6, message:len()) ~= "%d+" then
        local a, b = message:find(" ")
        local c, d = message:find(" ", b + 1)

        local meshId = message:sub(b + 1, d)
        local textureId = message:sub(d + 1, message:len())

        local hat = game:GetService("InsertService"):LoadAsset(tonumber(meshId)):GetChildren()[1]
        hat.Parent = character
        hat.Handle.Mesh.TextureId = "http://www.roblox.com/asset/?id=" .. textureId
        print("添加帽子 " .. meshId .. " 到 " .. player.Name .. " 并且使用纹理 "  .. textureId)
    end

出现了一个问题,当我输入 /hat hatIdHere 后,它进入了 elseif 语句并且报告了 local hat = game:GetService(--[===[etc]===] 行的错误。

其实不应该有错误,因为那段代码不应该被执行。但是,如果我输入 /hat meshId textureId,它就能正常工作。

请帮帮我,我不知道为什么它不工作。我的 message 是一个定义好的字符串。

点赞