Advertisement
Guest User

Server Control Commands

a guest
Apr 5th, 2020
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.64 KB | None | 0 0
  1. -- Script by lnsertYourself
  2. local whitelist = {"alwaysbloo", "BmanPlays","Frrankos","omarzarur","todomo"}
  3. local VIPgamepassId = 8839590
  4. local closeAll = "!closeALL"
  5. local openAll = "!openALL"
  6. local openVip = "!openVIP"
  7. local closeAllMessage = "Sorry, the server is closed to all players."
  8. local noGamepassMessage = "You must own the VIP gamepass to enter the game at this time."
  9.  
  10. --// DO NOT MODIFY BEYOND THIS POINT \\--
  11. local currentStatus = closeAll
  12. local commands = {closeAll, openAll, openVip}
  13. local marketplaceService = game:GetService("MarketplaceService")
  14.  
  15. game.Players.PlayerAdded:Connect(function(player)
  16.     if currentStatus == openAll then
  17.         -- Allow everyone in
  18.     elseif currentStatus == closeAll then
  19.         -- Only allow whitelisted players
  20.         if not table.find(whitelist, player.Name) then
  21.             player:Kick(closeAllMessage)
  22.         end
  23.     elseif currentStatus == openVip then
  24.         -- Only allow whitelisted players and VIP players
  25.         if not table.find(whitelist, player.Name) then
  26.             local success, result = pcall(function()
  27.                 return marketplaceService:UserOwnsGamePassAsync(player.UserId, VIPgamepassId)
  28.             end)
  29.             if success then
  30.                 if not result then
  31.                     -- User does not own gamepass
  32.                     player:Kick(noGamepassMessage)
  33.                 end
  34.             else
  35.                 -- Async failed
  36.                 player:Kick("Player status retrieval failed. Please try again.")
  37.             end
  38.         end
  39.     end
  40.     if table.find(whitelist, player.Name) then
  41.         -- Whitelisted player
  42.         player.Chatted:Connect(function(message, recipient)
  43.             local index = table.find(commands, message)
  44.             if index then
  45.                 -- One of the Server Status Commands
  46.                 currentStatus = commands[index]
  47.             end
  48.         end)
  49.     end
  50. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement