Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Would this script work?

Asked by
IcyEvil 260 Moderation Voter
10 years ago

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

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
10 years ago

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.

Ad
Log in to vote
0
Answered by 10 years ago

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

Answer this question