Search code examples
luamultiplayer

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


This error came with this script, can anyone find the error?

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")

Solution

  • You need to have two ends: one to close the if statement and one to close function. You are probably missing end between lines 5 and 6.