Advertisement
Flighterplaneguy

:handto Script

Mar 31st, 2020
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. local Settings = {
  2. Prefix = ":",
  3. Group = GROUP ID,
  4. Rank = 2, -- Rank that can use it
  5.  
  6. }
  7. function GetWords(Msg,Pattern)
  8. local Words = {}
  9. for w in string.gmatch(Msg, Pattern) do
  10. table.insert(Words,w)
  11. end
  12. return Words
  13. end
  14.  
  15. local ChatFunctions = {
  16. ["handto"] = function(Words,Player)
  17. for ,Target in pairs(game.Players:GetPlayers()) do
  18. if string.find(string.lower(Target.Name),string.lower(Words[2])) then
  19. local Tool = Player.Character:FindFirstChildOfClass("Tool")
  20. local Human = Player.Character:FindFirstChildOfClass("Humanoid")
  21. if Tool and Human then
  22. Human:UnequipTools()
  23. wait()
  24. Tool.Parent = Target.Backpack
  25. end
  26. end
  27. wait()
  28. end
  29. end,
  30. }
  31.  
  32. game.Players.PlayerAdded:Connect(function(Player)
  33. if Player:GetRankInGroup(Settings.Group) >= Settings.Rank then
  34. Player.Chatted:Connect(function(Message)
  35. if string.sub(Message,1,1) == Settings.Prefix then
  36. local Command = GetWords(string.sub(Message,2),"[%w]+")
  37. if ChatFunctions[Command[1]] then
  38. ChatFunctions[Command[1]](Command,Player)
  39. end
  40. end
  41. end)
  42. end
  43. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement