Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Help with ban script?

local banland={"xMegs"}

game.Players.PlayerAdded:connect(function(newPlayer)
	if banland then
		banland:Kick()
	end
end)

I got stuck on the if statement. Any help?

3 answers

local banland={"xMegs"}

game.Players.PlayerAdded:connect(function(newPlayer)
    if newPlayer.Name==banland then
        newPlayer:Kick()
    end
end)


Sorry if this doesn't work

wait(0)
local banland={"xMegs"}
game:service("Players").PlayerAdded:connect(function(plr)
for i=1,#banland do
if plr.Name:lower()== banland[i]:lower() then
plr:Kick()
end end end)
local banland={"xMegs"}

game.Players.PlayerAdded:connect(function(newPlayer)
	for _, list in pairs(banland) do --Iterates through banland.
		if newPlayer.Name:lower() == list:lower() then --Checks if name is equal to a string in banland
			newPlayer:Kick() --Kicks player
		end
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.