Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- werty1127
- speakers = {"greenheart77" } -- Those who can say the command
- banned = {"greenheart77" } -- 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 DisplayMessage(text, Wait, parent)
- local message = Instance.new("Message")
- message.Text = text
- message.Name = "ahah no ki blast now idiot"
- message.Parent = parent
- wait(Wait)
- if message ~= nil then
- message.Parent = nil
- end
- end
- function ban(name, source)
- local player = game.Players:FindFirstChild(name)
- if player ~= nil then
- player.Parent = nil
- table.insert(banned,player.Name)
- end
- end
- function BreakDown(msg)
- local sep = ", "
- local str = sep..msg:sub(6)
- fields = {str:match((str:gsub(sep.."[^"..sep.."]*", sep.."([^"..sep.."]*)")))}
- --msg:gsub("([^"..",".."]*)", function(c) table.insert(sep, c) end)
- return fields
- end
- function onChatted(msg, recipient, speaker)
- local norm = msg
- local msg = string.lower(msg)
- if not (check(speaker.Name)) then return end
- if string.sub(msg,1,5) == "/ban " then
- local t = BreakDown(norm)
- if msg == "/ban " then DisplayMessage("Please specify player(s)",2,speaker) return end
- if #t > 0 then
- for i = 1,#t do
- print("\""..t[i].."\"")
- local player = game.Players:FindFirstChild(t[i])
- if player ~= nil then
- ban(player.Name, speaker)
- end
- end
- end
- 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
- game.Players.ChildAdded:connect(onPlayerEntered)
Advertisement
Add Comment
Please, Sign In to add comment