')' expected (toclose '(' at line 453) near 'end'(在第453行丢失右括号,期望闭合左括号)

我找不到哪里应该放右括号。 请帮助我解决这个问题。 谢谢:)

ShootButton.MouseButton1Click:Connect(function()
local Person = NameShoot.Text
local A_1 = "right"
local A_2 = Vector3.new(-304.910004, 792.936279, -1810.74658)
local A_3 = Vector3.new(-321.448303, 792.981812, -1801.7301)
local A_4 = 0.0094182577133179
local A_5 = 2000
local A_6 =
game:GetService("Workspace").TopPiece.Suit.RightHand.Thruster.Exhaust
local A_7 = game:GetService("Workspace")[Person].Suit.RightUpperArm.Union
local Event =
game:GetService("Players").TopPiece.Backpack.suitControl.Assets.Events.fireR
epulsor
Event:InvokeServer(A_1, A_2, A_3, A_4, A_5, A_6, A_7)
end
end)
点赞
用户8773819
用户8773819

现在我不懂 lua,但我的猜测是将此处更改:

end
end)

为:

end)

看起来你是用第一个 end 结束了函数,但是在函数已经完成的情况下,用第二个 end 来关闭括号。

2019-02-03 07:23:44
用户1009432
用户1009432

如果你一贯缩进你的代码,那么你就应该会遇到更少这样的问题...

ShootButton.MouseButton1Click:Connect(
  function()
    local Person = NameShoot.Text
    local A_1 = "right"
    local A_2 = Vector3.new(-304.910004, 792.936279, -1810.74658)
    local A_3 = Vector3.new(-321.448303, 792.981812, -1801.7301)
    local A_4 = 0.0094182577133179
    local A_5 = 2000
    local A_6 = game:GetService("Workspace").TopPiece.Suit.RightHand.Thruster.Exhaust
    local A_7 = game:GetService("Workspace")[Person].Suit.RightUpperArm.Union
    local Event = game:GetService("Players").TopPiece.Backpack.suitControl.Assets.Events.fireRepulsor
    Event:InvokeServer(A_1, A_2, A_3, A_4, A_5, A_6, A_7)
  end
)

很明显,函数有一个 end 以及 Connect 调用中有一个闭合的圆括号。

你也可以这样做...

ShootButton.MouseButton1Click:Connect(function()
  local Person = NameShoot.Text
  local A_1 = "right"
  local A_2 = Vector3.new(-304.910004, 792.936279, -1810.74658)
  local A_3 = Vector3.new(-321.448303, 792.981812, -1801.7301)
  local A_4 = 0.0094182577133179
  local A_5 = 2000
  local A_6 = game:GetService("Workspace").TopPiece.Suit.RightHand.Thruster.Exhaust
  local A_7 = game:GetService("Workspace")[Person].Suit.RightUpperArm.Union
  local Event = game:GetService("Players").TopPiece.Backpack.suitControl.Assets.Events.fireRepulsor
  Event:InvokeServer(A_1, A_2, A_3, A_4, A_5, A_6, A_7)
end)

... 但我个人认为第一种格式更清晰。

2019-02-03 16:12:25