Advertisement
DrawingJhon

Make people tool script

Jun 27th, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. local function playerTool(plr)
  2.     if plr.Character then
  3.         if plr.Character:findFirstChild("HumanoidRootPart") then
  4.             local tool = Instance.new("Tool",workspace)
  5.             tool.Name = plr.Name
  6.             plr.Character.Parent = tool
  7.             local humRootPart = plr.Character:findFirstChild("HumanoidRootPart")
  8.             humRootPart.Name = "Handle"
  9.             humRootPart.Parent = tool
  10.         end
  11.     end
  12. end
  13.  
  14. local Players = game:GetService("Players")
  15. local owner = Players.JhonXD2006
  16. owner.Chatted:Connect(function(msg)
  17.     if msg:lower() == "tool/me" then
  18.         playerTool(owner)
  19.     elseif msg:lower() == "tool/random" then
  20.         local numRandom = math.random(1,#Players:GetPlayers())
  21.         for i, v in pairs(Players:GetPlayers()) do
  22.             if v == Players:GetChildren()[numRandom] then
  23.                 playerTool(v)
  24.             end
  25.         end
  26.     elseif msg:lower() == "tool/all" then
  27.         for i, v in pairs(Players:GetPlayers()) do
  28.             playerTool(v)
  29.         end
  30.     elseif msg:lower() == "tool/others" then
  31.         for i, v in pairs(Players:GetPlayers()) do
  32.             if v.Name ~= owner.Name then
  33.                 playerTool(v)
  34.             end
  35.         end
  36.     elseif msg:sub(1,5):lower() == "tool/" then
  37.         for i, v in pairs(Players:GetPlayers()) do
  38.             local wordLen = string.len(msg:sub(6))
  39.             local word = msg:sub(6):lower()
  40.             if word == v.Name:sub(1,wordLen):lower() then
  41.                 playerTool(v)
  42.             end
  43.         end
  44.     end
  45. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement