End Issue (underlined with red)

Hey there. I am making admin commands for my upcoming hangout game. I was about to enter another command when it’s passed to red. I tried adding one end, two end. You can view my script here:

Or via coding blocks:

local direction = {"achdef"}
local resource = {"BakDoor", "Unavailabl_3"}
local intern = {"tysyaka", "IceTheOneAndOnly"}
local SS = game:GetService("ServerStorage")

game.Players.PlayerAdded:Connect(function(plr)
	if table.find(direction, plr.Name) or table.find(resource, plr.Name) or table.find(intern, plr.Name) then
		plr.Chatted:Connect(function(msg)
			if string.lower(msg) == "!stop server" then
				for i,v in pairs(game.Players:GetPlayers()) do
					v:Kick("\nSAT CORPORATION\n\nDisconnected.\n\nType: Server Connection Lost\n\n A Member of the SAT Staff Team ("..plr.Name..") has stopped the server for several reasons.")
				end -- Error start here
			elseif string.lower(msg) == "e" then
				
				end
			end
		end) -- The underlined end
	end
end)
1 Like

Hello, I believe you have to remove one end after the underlined end).

You accidently put an end after elseif that wasn’t supposed to be there, so you should remove it.

…Do you not see the extra end inside of the elseif?

I feel a bit dumb right now that it’s was that simple.

1 Like

Please read your code thoroughly before posting, it can prevent simple errors like these

1 Like

Exactly what I did. But in my head, level lua on the AlvinBlox tutorials I am only at the functions, otherwise I am very low in knowledge of Lua.

1 Like

Last thing, how do I get how many players in total is in the server?

You literally already did that, game.Players:GetPlayers(), but if you want the amount exactly, just put a # before it, if there are 3 people in the server adn you print #game.Players:GetPlayers(), it will print 3

1 Like