|
| 17 Jul 2012 01:35 PM |
Ok so I want this script to work --- Thi
s is the bit that is not working: while true do wait(5) local players = game.Players:GetPlayers() for n = 1, #players do if player.leaderstats.level.Value > 25000 then --if it is more than 25000 then BAN THEM! ban (players[n]) end end return end end
This is the rest of the code:
speakers = {"XxKonArtistxX"} -- Those who can say the command banned = {"Exploiters"} -- Those who are banned
function check(name) print(name) if #speakers == 0 then print("No speakers") return false end for i = 1,#speakers do if string.upper(name) == string.upper(speakers[i]) then return true end end return false end
function ban(player, source) if player ~= nil then if player ~= source then player:Remove() table.insert(banned,player.Name) end end end
function unban(player,source) if player ~= nil then for i = 1,#banned do if banned[i]:lower() == player.Name:lower() then table.remove(banned,i) end end end end
function onChatted(msg, recipient, speaker) local norm = msg local msg = string.lower(msg)
if not check(speaker.Name) then return end
if string.match(msg,"unban") then local players = game.Players:GetPlayers() for n = 1, #players do if string.match(msg,players[n].Name:lower()) then unban(players[n], speaker) end end return end
if string.match(msg,"ban") then local players = game.Players:GetPlayers() for n = 1, #players do if string.match(msg,players[n].Name:lower()) then ban(players[n], speaker) end end return end end
function onPlayerEntered(newPlayer) print("entered") newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) for i=1, #banned do if banned[i]:lower() == newPlayer.Name:lower() then newPlayer.Parent = nil end end end
while true do wait(5) local players = game.Players:GetPlayers() for n = 1, #players do if player.leaderstats.level.Value > 25000 then --if it is more than 25000 then BAN THEM! ban (players[n]) end end return end end
game.Players.ChildAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
Techwiz19
|
  |
| Joined: 30 Jan 2011 |
| Total Posts: 462 |
|
| |