Alief_Athallah

Put The Script In The Tool

May 25th, 2020
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1. local debounce = false
  2.  
  3. function getPlayer(humanoid)
  4. local players = game.Players:children()
  5. for i = 1, #players do
  6. if players[i].Character.Humanoid == humanoid then return players[i] end
  7. end
  8. return nil
  9. end
  10.  
  11. function onTouch(part)
  12.  
  13. local human = part.Parent:findFirstChild("Humanoid")
  14. if (human ~= nil) and debounce == false then
  15.  
  16. debounce = true
  17.  
  18. local player = getPlayer(human)
  19.  
  20. if (player == nil) then return end
  21.  
  22. script.Parent:clone().Parent = player.Backpack
  23.  
  24. wait(2)
  25. debounce = false
  26. end
  27. end
  28.  
  29.  
  30. script.Parent.Parent.Touched:connect(onTouch)
Add Comment
Please, Sign In to add comment