Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Ban/Unban Command Created by OFX7X
- --If it does not work comment on my youtube channel or message me on discord: OFX7X#2421
- local DataStoreService = game:GetService("DataStoreService")
- local BanStore = DataStoreService:GetDataStore("BanStore1")
- local Players = game:GetService("Players")
- local Whitelists = require(script:WaitForChild("Whitelists"))
- Players.PlayerAdded:Connect(function(Player)
- local Data = BanStore:GetAsync(Player.UserId)
- if Data then
- Player:Kick("You are banned")
- end
- Player.Chatted:Connect(function(Message)
- if table.find(Whitelists, Player.UserId) then
- local Arguments = Message:split(" ")
- if Arguments[1]:lower() == "/ban" then
- if Arguments[2] then
- local PlayerId = Players:GetUserIdFromNameAsync(Arguments[2])
- if PlayerId then
- BanStore:SetAsync(PlayerId, true)
- for _, Plr in pairs(Players:GetPlayers()) do
- if Plr.Name:lower() == Arguments[2]:lower() then
- Plr:Kick("You have been banned")
- end
- end
- end
- end
- elseif Arguments[1]:lower() == "/unban" then
- if Arguments[2] then
- local PlayerId = Players:GetUserIdFromNameAsync(Arguments[2])
- if PlayerId then
- if BanStore:GetAsync(PlayerId) then
- BanStore:RemoveAsync(PlayerId)
- end
- end
- end
- end
- end
- end)
- end)
Add Comment
Please, Sign In to add comment