Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local DataStoreService = game:GetService("DataStoreService")
- local Admins = {2773194693} --// ohusq (Owner)
- local Commands = {
- ["kill"] = function(Player)
- --// Kill All Players
- print("Killing:", Player)
- if Player == "others" then
- for _, Player in pairs(game.Players:GetPlayers()) do
- if Player ~= game.Players.LocalPlayer then
- Player.Character.Humanoid.Health = 0
- end
- end
- return --// Return to prevent the rest of the code from running
- end
- Player.Character.Humanoid.Health = 0
- end,
- ["kick"] = function(Player)
- Player:Kick("You have been kicked from this server.")
- end,
- ["ban"] = function(Player)
- Player:Kick("You have been banned from this game.")
- end
- }
- local BanList = DataStoreService:GetDataStore("BannedPlayers")
- local Prefix = "."
- game.Players.PlayerAdded:Connect(function(Player)
- --// Check if player is banned
- local Success, Banned = pcall(function()
- return BanList:GetAsync(Player.UserId)
- end)
- if Success and Banned then
- Player:Kick("You have been banned from this game.")
- end
- --// Check if player is admin
- local IsAdmin = false
- if table.find(Admins, Player.UserId) then
- IsAdmin = true
- else
- IsAdmin = false
- end
- --// Admin commands with prefix (.)
- Player.Chatted:Connect(function(Message)
- if IsAdmin then
- local Args = string.split(Message, " ")
- local Command = Args[1]
- local Target = Args[2]
- if string.sub(Command, 1, 1) == Prefix then
- Command = string.sub(Command, 2)
- if Commands[Command] then
- if Target then
- local TargetPlayer = game.Players:FindFirstChild(Target)
- if TargetPlayer then
- Commands[Command](TargetPlayer)
- end
- else
- Commands[Command](Player)
- end
- end
- end
- end
- end)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement