Advertisement
Kezoto

Untitled

Apr 17th, 2021
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. local Players = game:GetService("Players")
  2. local toolname = 'Passport'
  3.  
  4. local db = true
  5. Players.PlayerAdded:Connect(function(player)
  6. f = Instance.new("Folder")
  7. f.Name = player.Name
  8. f.Parent = game.ReplicatedStorage
  9. end)
  10.  
  11. Players.PlayerRemoving:Connect(function(player)
  12. f:Destroy()
  13. end)
  14. local Zone = script.Parent
  15. local IsTouching = false
  16. script.Parent.Touched:Connect(function(hit)
  17. IsTouching = true
  18. if hit == nil then return end
  19. local h = game.Players:GetPlayerFromCharacter(hit.Parent)
  20. if h ~= nil and h.Backpack:GetChildren() then
  21. local fz = game.ReplicatedStorage:FindFirstChild(hit.Parent.Name)
  22. local c = h.Backpack:GetChildren()
  23. for i=1,#c do
  24. if c[i].Name~="Passport" then c[i].Parent = fz end
  25. end
  26. end
  27. for _, child in pairs(hit.Parent:GetChildren()) do
  28. local c = hit.Parent:GetChildren()
  29. local fz = game.ReplicatedStorage:FindFirstChild(hit.Parent.Name)
  30. if child:IsA("Tool") and not child.Name == toolname then
  31. child.Parent = fz
  32. end
  33. end
  34. end)
  35.  
  36. script.Parent.TouchEnded:Connect(function(hit)
  37. IsTouching = false
  38. if hit == nil then return end
  39. local h = game.Players:GetPlayerFromCharacter(hit.Parent)
  40. local fz = game.ReplicatedStorage:FindFirstChild(hit.Parent.Name)
  41. if h ~= nil and game.ReplicatedStorage:FindFirstChild(hit.Parent.Name) then
  42. local fo = fz:GetChildren()
  43. for i=1,#fo do
  44. if fo[i].Name~="Passport" then fo[i].Parent = h.Backpack end
  45. end
  46. end
  47. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement