Syntax Error in Singplayer but not Multiplayer?

This is my code, the aim of this is to create a scoreboard that shows the staff members that are online currently.
Everything works completely fine in Singplayer, but in Multiplayer it won’t open and returns a syntax error. If anyone can offer some help, it would be much appreciated.



surface.CreateFont( "traverse_f2_font_1", {
	font = "Trebuchet24",
	extended = false,
	size = 22,
	weight = 500,
	blursize = 0,
	scanlines = 0,
	antialias = true,
	underline = false,
	italic = false,
	strikeout = false,
	symbol = false,
	rotary = false,
	shadow = false,
	additive = false,
	outline = false,
})

local traverse_f2_scoreboard = nil
local traverse_f2_playerlist = nil 
hook.Add( "Think", "BM_Clients_Key", function()
	if input.IsKeyDown(KEY_F2) then
		if ply == LocalPlayer() then
		if !IsValid(traverse_f2_scoreboard) then
			traverse_f2_scoreboard = vgui.Create("DFrame")
			traverse_f2_scoreboard:SetSize(400,400)
			traverse_f2_scoreboard:Center()
			traverse_f2_scoreboard:SetTitle("   ")
			traverse_f2_scoreboard:SetDraggable(false)
			traverse_f2_scoreboard:ShowCloseButton(false)
			traverse_f2_scoreboard:MakePopup()
			traverse_f2_scoreboard.Paint = function(s,w,h)
				draw.RoundedBox(0,0,0,w,25,Color(0,133,255,255))
				draw.RoundedBox(0,0,25,w,h - 25,Color(40,40,40,255))
				draw.RoundedBox(0,0,25,w,35,Color(27,27,27,255))
				draw.SimpleText("Online Staff Members","traverse_f2_font_1",w / 2,2,Color(255,255,255,255),TEXT_ALIGN_CENTER)
				draw.SimpleText("Name", "traverse_f2_font_1", 10, 32, Color(255,255,255,255),TEXT_ALIGN_LEFT)
				draw.SimpleText("Rank", "traverse_f2_font_1", 300, 32, Color(255,255,255,255),TEXT_ALIGN_LEFT)
			end

			local traverse_f2_scrollpanel = vgui.Create("DScrollPanel", traverse_f2_scoreboard)
			traverse_f2_scrollpanel:SetSize(traverse_f2_scoreboard:GetWide(),traverse_f2_scoreboard:GetTall() - 60)
			traverse_f2_scrollpanel:SetPos(0,50)
			traverse_f2_playerlist = vgui.Create("DListLayout",traverse_f2_scoreboard)
			traverse_f2_playerlist:SetSize(traverse_f2_scrollpanel:GetWide(),traverse_f2_scrollpanel:GetTall())
			traverse_f2_playerlist:SetPos(0,60)
		end

		if IsValid(traverse_f2_scoreboard) then
			traverse_f2_playerlist:Clear()

			for k, v in pairs(player.GetAll()) do
				if v:IsUserGroup("moderator") or v:IsUserGroup("admin") or v:IsUserGroup("superadmin") or v:IsUserGroup("founder") then
					local traverse_f2_playerpanel = vgui.Create("DPanel", traverse_f2_playerlist)
					traverse_f2_playerpanel:SetSize(traverse_f2_playerlist:GetWide(),44)
					traverse_f2_playerpanel:SetPos(5,5)
					traverse_f2_playerpanel.Paint = function(s,w,h)
						draw.RoundedBox(0,5,5,w - 10,h,Color(27,27,27,255))
						draw.RoundedBox(0,5,42,w - 10,h,Color(0,133,255,255))

						local name = "Disconnected"
						local rank = "Unknown"

						if IsValid(v) then
						  name = v:Nick()
						  rank = v:GetUserGroup()
						  rankcaps = string.upper(v:GetUserGroup())
						  rankname = string.Replace(rank,string.sub(rank,1,1),string.sub(rankcaps,1,1))
						end


						draw.SimpleText(name,"traverse_f2_font_1",44,12,Color(255,255,255,255),TEXT_ALIGN_LEFT)
						draw.SimpleText(rankname,"traverse_f2_font_1",320,12,Color(255,255,255,255),TEXT_ALIGN_CENTER)
					end
					local traverse_f2_avatar = vgui.Create("AvatarImage",traverse_f2_playerpanel)
					traverse_f2_avatar:SetSize(29,29)
					traverse_f2_avatar:SetPos(9,9)
					traverse_f2_avatar:SetPlayer(LocalPlayer(),29)
					
					local traverse_f2_scoreboard_close = vgui.Create("DButton", traverse_f2_scoreboard)
					traverse_f2_scoreboard_close:SetSize(traverse_f2_scoreboard:GetWide() / 1.8, 40)
					traverse_f2_scoreboard_close:SetPos(traverse_f2_scoreboard:GetWide() / 2 - 100 - 5 - 6,traverse_f2_scoreboard:GetTall() - 50)
					traverse_f2_scoreboard_close:SetText("Close")
					traverse_f2_scoreboard_close:SetTextColor(Color(255,255,255,255))
					traverse_f2_scoreboard_close:SetFont("traverse_f2_font_1")
					traverse_f2_scoreboard_close.Paint =  function (s,w,h)
						draw.RoundedBox(0,0,0,w,h,Color(0,111,244))
						draw.RoundedBox(0,5,5,w - 10, h - 10,Color(0,133,255,255))
					end
					traverse_f2_scoreboard_close.DoClick = function() traverse_f2_scoreboard:Remove() end
				end
			end
		end
	end
	-----------------------------------------------------------------------------------
	end
end)


Error:



[ERROR] addons/traverse_f2/lua/autorun/client/traverse_f2.lua:95: unexpected symbol near ')'
  1. unknown - addons/traverse_f2/lua/autorun/client/traverse_f2.lua:0


o.o? line 95 is the comments

Exactly. It’s kind of weird. I’m honestly not even sure where to start. I’ve had multiple people look over it and they’ve found no solution.

Have you tried running it through parsers? Maybe they can find the real problem.

http://rextester.com/l/lua_online_compiler

[editline]22nd July 2017[/editline]


		if !IsValid(traverse_f2_scoreboard) then

What’s with the use of ! ?

It was used in a tutorial to make a scoreboard that followed the same kind of idea that I was going for.
EDIT: And it worked with the scoreboard I made.

What do you mean? He’s checking if its not valid then if its not he creates it

arkonaluaknowledge = 0

While, that operator is not part of regular Lua (afaik), it’s just something they added in gmod because it exists in most languages so people who are used to it can use it.

Ahhh

Most likely you accidentally put some symbol there that was lost when you copypasted the code.

Try copying it back over your code from your post and make sure that you don’t have that file anywhere else like another addon.