'end expected near eof ' 出错,我找不到解决方案

There's an error with 'end expected near eof ' and I can't find the solution

此脚本出现此错误,有人能找到错误吗?

function checkPing(thePlayer)
    ping = getPlayerPing(thePlayer)
    if ( ping > 500 ) then
    kickPlayer (thePlayer ,ToohighPing)
    outputChatBox (getPlayerName(thePlayer).."Has been kicked due to High ping",255,255,0)
end
addEventHandler ("OnResourceStart")

您需要两个 end:一个用于关闭 if 语句,一个用于关闭 function。您可能在第 5 行和第 6 行之间遗漏了 end