<name> 预期出现 'end' 错误

当我运行我的 Lua 代码时,我遇到了 'name' 预期出现 'end' | 第 12 行的错误

这是代码:

local i = 1
local plr = game.Players.LocalPlayer

function start()
repeat
    wait()
    game.ReplicatedStorage.addpoints:FireServer()
until i == 2
end

function end()
i = 2
end

plr.Chatted:connect(function(message)
if message == "start" then
    start()
elseif message == "end" then
    end()
end
end)

有什么解决方法吗?

点赞
用户1009479
用户1009479
函数 end()
  i = 2
end

在这里,end是一个关键字,你不能用它作为函数名。stop怎么样?

2017-11-24 11:19:34