Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Players = game:GetService("Players")
- local toolname = 'Passport'
- local db = true
- Players.PlayerAdded:Connect(function(player)
- f = Instance.new("Folder")
- f.Name = player.Name
- f.Parent = game.ReplicatedStorage
- end)
- Players.PlayerRemoving:Connect(function(player)
- f:Destroy()
- end)
- local Zone = script.Parent
- local IsTouching = false
- script.Parent.Touched:Connect(function(hit)
- IsTouching = true
- if hit == nil then return end
- local h = game.Players:GetPlayerFromCharacter(hit.Parent)
- if h ~= nil and h.Backpack:GetChildren() then
- local fz = game.ReplicatedStorage:FindFirstChild(hit.Parent.Name)
- local c = h.Backpack:GetChildren()
- for i=1,#c do
- if c[i].Name~="Passport" then c[i].Parent = fz end
- end
- end
- for _, child in pairs(hit.Parent:GetChildren()) do
- local c = hit.Parent:GetChildren()
- local fz = game.ReplicatedStorage:FindFirstChild(hit.Parent.Name)
- if child:IsA("Tool") and not child.Name == toolname then
- child.Parent = fz
- end
- end
- end)
- script.Parent.TouchEnded:Connect(function(hit)
- IsTouching = false
- if hit == nil then return end
- local h = game.Players:GetPlayerFromCharacter(hit.Parent)
- local fz = game.ReplicatedStorage:FindFirstChild(hit.Parent.Name)
- if h ~= nil and game.ReplicatedStorage:FindFirstChild(hit.Parent.Name) then
- local fo = fz:GetChildren()
- for i=1,#fo do
- if fo[i].Name~="Passport" then fo[i].Parent = h.Backpack end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement