'end' expected (to close 'if' at line 9)

Can anyone find the wrong part. I cant see anything wrong

Error Message : [ERROR] lua/shared.lua:10: ‘end’ expected (to close ‘if’ at line 9) near ‘tableticket’

Code:


   AddCSLuaFile ("shared.lua");
if SERVER then
  tableticket = {}
  util.AddNetworkString("openticket")
  util.AddNetworkString("stringcall")
  
  net.Receive("Stringcall" , function(len , ply)
              for i = 1,table.Count(tableticket) do
			      if isValid(tableticket*)==false then break 
				  tableticket* = net.ReadString()
		  		       
		      end
 end
 end)
  
  
  hook.Add("PlayerSay", "chatticket", function(ply, text, public)
if text == "/ticket" then
net.Start("openticket")
net.Send(ply)

end
end)
  

  end

Fix your indentation and you’ll see the problem.
[lua]
AddCSLuaFile (“shared.lua”);
if SERVER then
tableticket = {}
util.AddNetworkString(“openticket”)
util.AddNetworkString(“stringcall”)

net.Receive("Stringcall" , function(len , ply)
	for i = 1,table.Count(tableticket) do
		if isValid(tableticket*)==false then
			break
			tableticket* = net.ReadString()
		end
	end
end)


hook.Add("PlayerSay", "chatticket", function(ply, text, public)
	if text == "/ticket" then
		net.Start("openticket")
		net.Send(ply)
	end
end)

end
[/lua]
I’m not 100% sure what you’re trying to do, but ‘break’ has to be the last thing in the block.
[lua]
– can do this
for i = 1, 10 do
if i < 8 then break end
print(i)
end

– can’t do this
for i = 1, 10 do
break
print(i)
end[/lua]

The error makes it obvious. There is an if statement at line 9, you never put an “end” to close it. Even if you did put and end to close it check every other function, loop, if statement, or anything that needs an end to find of any of them aren’t closed.