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

Would this script work?

I had gotten bored so I made a Ban script, and I need to know if it works.

Bans = {"Player1"}
local Kick = false -- set to true to kick
for i,v in pairs(Bans) do
 if v.Name == #Bans then
	elseif Kick = true then
v:Kick()
end
end
end
end

2 answers

No this script would not work.

  1. You're using #Bans, a number compared to a player's name. Line 4.
  2. You're using elseif if the player is not the first and last one in the list they would be kicked. Line 5.
  3. The script will expect "==" for is equal to. Line 5.
  4. You don't have a player to compare the v to for the entire script to work.
  5. And even if for some reason the script did work, it wouldn't repeat to see if a banned person was in the game.

I can not modify the script at this time.

Nope, but try this

local bans = {"Random"}

function onjoin(player)
for i = 1, #bans do
if bans[i] == player.Name
then
player:remove()
end
end
end

game.Players.PlayerAdded:connect(onjoin)

Your mistake was you need to have a players actual child in game.Players to compare

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