Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players");
- local DatastoreService = game:GetService("DataStoreService");
- -- setting up the database
- local BanDatabase = DatastoreService:GetDataStore("InDevelopmentTesting")
- local AmTimeStorage = BanDatabase:GetAsync("TimeLeft")
- local PastBanTimes = BanDatabase:GetAsync("isBanned", false);
- local ReasonStorage = BanDatabase:GetAsync("Reason");
- local bantime = 0
- function checkBan(pl, length, reason)
- local UserDatabase = BanDatabase:GetAsync(pl.Name .. "_TempBan")
- if length == "0 hours" then
- UserDatabase:UpdateAsync("isBanned", false)
- UserDatabase:UpdateAsync("Reason", nil)
- UserDatabase:UpdateAsync("timeLeft", 0)
- end
- if length == "12 hours" then
- UserDatabase:UpdateAsync("isBanned", true)
- UserDatabase:UpdateAsync("Reason", reason)
- UserDatabase:UpdateAsync("timeLeft", 12)
- game.Players:FindFirstChild(pl):Kick("You have been temporarily banned from the game.\nReason: "..reason);
- end
- if length == "24 hours" then
- UserDatabase:UpdateAsync("isBanned", true)
- UserDatabase:UpdateAsync("Reason", reason)
- UserDatabase:UpdateAsync("timeLeft", 24)
- game.Players:FindFirstChild(pl):Kick("You have been temporarily banned from the game.\nReason: "..reason);
- end
- if length == "48 hours" then
- UserDatabase:UpdateAsync("isBanned", true)
- UserDatabase:UpdateAsync("Reason", reason)
- UserDatabase:UpdateAsync("timeLeft", 48)
- game.Players:FindFirstChild(pl):Kick("You have been temporarily banned from the game.\nReason: "..reason);
- end
- if length == "72 hours" then
- UserDatabase:UpdateAsync("isBanned", true)
- UserDatabase:UpdateAsync("Reason", reason)
- UserDatabase:UpdateAsync("timeLeft", 72)
- game.Players:FindFirstChild(pl):Kick("You have been temporarily banned from the game.\nReason: "..reason);
- end
- end
- return function (context, userid, reason)
- game.Players.PlayerAdded:Connect(function()
- checkBan()
- end)
- return ("Successfully banned".. userid .. "for");
- end
Add Comment
Please, Sign In to add comment