Advertisement
KingLoneCat

Annihilate Random Player

Apr 23rd, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.84 KB | None | 0 0
  1. local UIS = game:GetService("UserInputService")
  2. local players = game:GetService("Players")
  3. local plr = players.LocalPlayer
  4. script.Parent = plr
  5.  
  6. UIS.InputBegan:connect(function(object, gp)
  7. if object.KeyCode == Enum.KeyCode.Q and not gp then
  8.   local players_table = {}
  9.  
  10.   for i,v in pairs(players:GetChildren()) do
  11.     wait()
  12.     if (v.Character:findFirstChild("HumanoidRootPart")) then
  13.       table.insert(players_table, v.Name)
  14.     end
  15.   end
  16.   if (#players_table > 0) then
  17.     local num = math.random(1, #players_table)
  18.  
  19.  
  20.     local player_selected_name = players_table[num]
  21.  
  22.     if player_selected_name == "KingLoneCat" then
  23.       return end
  24.  
  25.       local player_selected = players[player_selected_name]
  26.  
  27.       local char_selected = player_selected.Character
  28.  
  29.  
  30.       char_selected.HumanoidRootPart:Destroy()
  31.  
  32.     end
  33.   end
  34.   end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement