Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getgenv().loop = true -- false to make it turn off
- local finditems = {"Box", "Barrel"} --[[ Put the things you want to get here like:
- {"Box", "Chest", "Barrel"} you can get more by going in item folder at the workspace and putting the item you want inside that folder will work]]
- while getgenv().loop do
- task.wait()
- pcall(function()
- local folder = game:GetService("Workspace").Item
- local items = folder:GetChildren()
- local closestItem = nil
- local minDistance = math.huge
- local tweenService = game:GetService("TweenService")
- local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
- local lp = game.Players.LocalPlayer
- function teleport(v, speed)
- if lp.Character and lp.Character:FindFirstChild('HumanoidRootPart') then
- local cf = CFrame.new(v)
- local tweenTime = ((lp.Character.HumanoidRootPart.Position - cf.p).Magnitude) / speed
- local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Linear)
- local a = tweenService:Create(lp.Character.HumanoidRootPart, tweenInfo, {CFrame = cf})
- a:Play()
- a.Completed:Connect(function()
- fireproximityprompt(closestItem.ProximityPrompt)
- end)
- end
- end
- for i, item in pairs(items) do
- for j, finditem in pairs(finditems) do
- if item.Name == finditem then
- local distance = (item.Position - lp.Character.HumanoidRootPart.Position).Magnitude
- if distance < minDistance then
- minDistance = distance
- closestItem = item
- end
- end
- end
- end
- if closestItem then
- teleport(closestItem.Position, 60)
- end
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement