Advertisement
ustinjamesss

sakurstand

Feb 2nd, 2023
906
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. getgenv().loop = true -- false to make it turn off
  2. local finditems = {"Box", "Barrel"} --[[ Put the things you want to get here like:
  3. {"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]]
  4.  
  5. while getgenv().loop do
  6. task.wait()
  7. pcall(function()
  8. local folder = game:GetService("Workspace").Item
  9. local items = folder:GetChildren()
  10. local closestItem = nil
  11. local minDistance = math.huge
  12.  
  13. local tweenService = game:GetService("TweenService")
  14. local tweenInfo = TweenInfo.new(1, Enum.EasingStyle.Linear)
  15.  
  16. local lp = game.Players.LocalPlayer
  17.  
  18. function teleport(v, speed)
  19. if lp.Character and lp.Character:FindFirstChild('HumanoidRootPart') then
  20. local cf = CFrame.new(v)
  21. local tweenTime = ((lp.Character.HumanoidRootPart.Position - cf.p).Magnitude) / speed
  22. local tweenInfo = TweenInfo.new(tweenTime, Enum.EasingStyle.Linear)
  23. local a = tweenService:Create(lp.Character.HumanoidRootPart, tweenInfo, {CFrame = cf})
  24. a:Play()
  25. a.Completed:Connect(function()
  26. fireproximityprompt(closestItem.ProximityPrompt)
  27. end)
  28. end
  29. end
  30.  
  31. for i, item in pairs(items) do
  32. for j, finditem in pairs(finditems) do
  33. if item.Name == finditem then
  34. local distance = (item.Position - lp.Character.HumanoidRootPart.Position).Magnitude
  35. if distance < minDistance then
  36. minDistance = distance
  37. closestItem = item
  38. end
  39. end
  40. end
  41. end
  42.  
  43. if closestItem then
  44. teleport(closestItem.Position, 60)
  45. end
  46. end)
  47. end
  48.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement