0
votes

when I ran my lua code I got the error 'name' expected near 'end' | Line 12

Here's the code:

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)

Any fix?

1
end higlighted.. - Mike V.

1 Answers

6
votes
function end()
  i = 2
end

Here, end is a keyword, you can't use it as a function name. How about stop?