Advertisement
DennisH1mself

Untitled

Oct 27th, 2023 (edited)
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. -- Kicking Script
  2. local reason = "Reason here"
  3. script.Parent.Touched:Connect(function(object)
  4. local player = game.Players:GetPlayerFromCharacter(object.Parent)
  5. if player ~= nil then
  6. player:Kick(reason)
  7. end
  8. end)
  9.  
  10. -- Banning Script
  11. local reason = "Reason here"
  12. local dbs = game:GetService('DataStoreService'):GetDataStore('BannedPlayers')
  13. function BanPlayer(player)
  14. dbs:SetAsync(tostring(player.UserId), true)
  15. player:Kick(reason)
  16. end
  17. script.Parent.Touched:Connect(function(object)
  18. local player = game.Players:GetPlayerFromCharacter(object.Parent)
  19. if player ~= nil then
  20. BanPlayer(player)
  21. end
  22. end)
  23. -- Keep Players Banned
  24. local dbs = game:GetService('DataStoreService'):GetDataStore('BannedPlayers')
  25. local banReason = 'Ban Reason Here'
  26. game.Players.PlayerAdded:Connect(function(player)
  27. local status = dbs:GetAsync(tostring(player.UserId))
  28. if status == true then
  29. player:Kick(banReason)
  30. end
  31. end)
  32. -- Unban Players
  33. game:GetService('DataStoreService'):GetDataStore('BannedPlayers'):RemoveAsync('User ID Here')
  34.  
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement