Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local pps = game:GetService("ProximityPromptService")
- local distance = 10
- local timeToHold = 0.5
- pps.PromptTriggered:Connect(function(pp, plr)
- local tool = pp.Parent.Parent
- if tool:IsA("Tool") then
- tool.Parent = plr.Backpack
- pp:Destroy()
- end
- end)
- while wait() do
- for i, descendant in pairs(workspace:GetDescendants()) do
- if descendant:IsA("Tool") and descendant:FindFirstChild("Handle") and not game.Players:GetPlayerFromCharacter(descendant.Parent) then
- if descendant.Handle:FindFirstChild("TouchInterest") then descendant.Handle.TouchInterest:Destroy() end
- local pp = descendant.Handle:FindFirstChild("ProximityPrompt")
- if not pp then
- pp = Instance.new("ProximityPrompt")
- pp.MaxActivationDistance = distance
- pp.HoldDuration = timeToHold
- pp.ObjectText = "Tool"
- pp.ActionText = "Pick Up"
- pp.Parent = descendant.Handle
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement