Advertisement
SanBlox

Sword Simulator Admin V1

Aug 9th, 2022
881
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 7.04 KB | None | 0 0
  1. --[[
  2. WARNING: The commands('cmds', 'admin' and 'unadmin' will make you chat)
  3. To kill silently type '/e kill' (it will kill everybody)[/align]
  4. [align=center]You cant kill the people that have force field on
  5. --------------------------
  6. Prefix --> ':'
  7. [0]CMDS:
  8. [1]kill (Me/Plr/Others/All)
  9. [2]admin (All/Plr)
  10. [3]unadmin (All/Plr)
  11. [4]Farm (Start Autofarm)
  12. [5]Unfarm (Stop Autofarm)
  13. [6]cmds (Commands)
  14. --------------------------
  15. --]]
  16. local isAdmin = {[game.Players.LocalPlayer.Name] = true, ["FRIEND1"] = true, ["FRIEND2"] = true} --Admins
  17. local lplr = game.Players.LocalPlayer.Name
  18. local au = false
  19. Owner = game:GetService("Players").LocalPlayer
  20. game:GetService("StarterGui"):SetCore("SendNotification", {
  21. Title = "Sword Simulator Admin";
  22. Text = "Enjoy Dominating";})
  23.  
  24. function GetPlayer(String)
  25.    local Found = {}
  26.    for i,v in pairs(game:GetService("Players"):GetPlayers()) do
  27.        if v.Name:lower():sub(1, #String) == String:lower() then
  28.            table.insert(Found,v)
  29.        end
  30.    end    
  31. return Found    
  32. end
  33.  
  34. local function AF()
  35. au = true
  36. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  37. while au do
  38.   game.Workspace[lplr].sword.Handle.up.RemoteEvent:FireServer() wait(.1)
  39.   if game.Players[lplr].Backpack["sword"] then
  40.      game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  41.   end
  42. end
  43. end
  44.  
  45. local function KA()
  46. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  47. for i,v in ipairs(game.Players:GetPlayers())do
  48. game.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  49. end end
  50.  
  51. local function KO()
  52. game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  53. for i,v in ipairs(game.Players:GetPlayers())do
  54. if v.Name ~= game.Players.LocalPlayer.Name then
  55. game.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  56. end end
  57. end
  58.  
  59. print'Loaded'
  60. function onChatted(message, player)
  61.    if message:sub(1, 6) == ";kill " and isAdmin[player.Name] then
  62.        if string.sub(message, 7) == "all" then
  63.            KA()
  64.        elseif string.sub(message, 7) == "me" then
  65.            game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  66.            ggame.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  67.        elseif string.sub(message, 7) == "others" then
  68.            if player.Name == Owner.Name then
  69.                KO()
  70.            else
  71.                game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  72.                for i,v in ipairs(game.Players:GetPlayers())do
  73.                if v.Name ~= player.Name then
  74.                game.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  75.                end end
  76.            end
  77.        else
  78.            game:GetService('Players').LocalPlayer.Character.Humanoid:EquipTool(game.Players[lplr].Backpack["sword"])
  79.            for i,v in pairs(GetPlayer(string.sub(message, 7)))do
  80.            local plr = v.Name
  81.  
  82.            for i,p in ipairs(game.Players:GetPlayers())do
  83.            if p.Name ~= game.Players.LocalPlayer.Name then
  84.            game.Workspace[lplr].sword.Handle.dmg.RemoteEvent:FireServer(workspace[v.Name].Humanoid, 9999999999999999999999)
  85.            end end end
  86.        end
  87.    end
  88.  
  89.    if message:sub(1, 7) == "/e kill" and isAdmin[player.Name] then
  90.        KA()
  91.    end
  92.  
  93.    if message:sub(1, 6) == ";cmds" then
  94.        if player.Name == Owner.Name then
  95.           wait(0.2)
  96.           game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]CMDS: [1]kill(me/plr/others/all), [2]admin(all/plr), [3]unadmin(all/plr), [4]af(autofarm), [5]saf(stop autofarm), [6]cmds", "All")
  97.        elseif isAdmin[player.Name] and player.Name ~= Owner.Name then
  98.           wait(0.2)
  99.           game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System] CMDS: [1]kill(me/plr/others/all), [2]admin(all/plr), [3]unadmin(all/plr), [4]cmds", "All")
  100.        end
  101.    end
  102.  
  103.    if message:sub(1, 7) == ";admin " and isAdmin[player.Name] then
  104.        if string.sub(message, 8) == "all" and isAdmin[Owner.Name] then
  105.            if isAdmin[Owner.Name] then
  106.                for i,plrs in ipairs(game:GetService('Players'):GetChildren())do
  107.                isAdmin[plrs.Name] = {true}
  108.                end
  109.                wait(0.2)
  110.                game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System] Everyone is now Admin!", "All")
  111.            end
  112.        else
  113.            for i,v in pairs(GetPlayer(string.sub(message, 8)))do
  114.            local plr = v.Name  
  115.            if  isAdmin[plr] then
  116.                game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]"..plr.." is already Admin!", "All")
  117.            else
  118.                isAdmin[plr] = {true}
  119.                wait(0.2)
  120.                game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]"..plr.." is now Admin!", "All")
  121.            end
  122.            end
  123.        end
  124.    end
  125.    
  126.    if message:sub(1, 9) == ";unadmin " and isAdmin[player.Name] then
  127.        if string.sub(message, 10) == "all" then
  128.            if isAdmin[Owner.Name] then
  129.                for i,plrs in ipairs(game:GetService('Players'):GetPlayers())do
  130.                    isAdmin[plrs.Name] = false
  131.                    isAdmin[Owner.Name] = true
  132.                end
  133.                wait(0.2)
  134.                game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System] Everyone is no longer Admin!", "All")
  135.            end
  136.        else
  137.            for i,v in pairs(GetPlayer(string.sub(message, 10)))do
  138.            local plr = v.Name
  139.            if plr == Owner.Name then
  140.                game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System] Error, this player is the Owner!", "All")
  141.            else
  142.                isAdmin[plr] = false
  143.                wait(0.2)
  144.                game:GetService("ReplicatedStorage").DefaultChatSystemChatEvents.SayMessageRequest:FireServer("[System]"..plr.." is no longer Admin!", "All")
  145.            end
  146.            end
  147.        end
  148.    end
  149.  
  150.    if message:sub(1, 3) == ";farm" and player.Name == Owner.Name then
  151.        AF()
  152.    end
  153.  
  154.    if message:sub(1, 4) == ";unfarm" and player.Name == Owner.Name then
  155.        au = false
  156.    end
  157. end
  158.  
  159. Players = game:GetService("Players")
  160. for i, player in pairs(Players:GetPlayers()) do
  161.    player.Chatted:connect(function(message) onChatted(message, player) end)
  162. end
  163.  
  164. --Check if someone joined
  165. game.Players.PlayerAdded:connect(function(player)
  166.    player.Chatted:connect(function(message) onChatted(message, player) end)
  167. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement