Advertisement
kob123678

Piggy Item Teleport Script

Mar 8th, 2022
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. local PiggyGui = Instance.new("ScreenGui")
  2. PiggyGui.Name = "PiggyGui"
  3. PiggyGui.Parent = game.StarterGui
  4. local ScrollingFrame = Instance.new("ScrollingFrame", PiggyGui)
  5. ScrollingFrame.BackgroundColor3 = Color3.new(0.15, 0.15, 0.15)
  6. ScrollingFrame.Position = UDim2.new(0.08, 0, 0.42, 0)
  7. ScrollingFrame.Size = UDim2.new(0, 296, 0, 388)
  8. local PiggyGui = Instance.new("ScreenGui")
  9. PiggyGui.Name = "PiggyGui"
  10. PiggyGui.Parent = game.CoreGui
  11. local ScrollingFrame = Instance.new("ScrollingFrame", PiggyGui)
  12. ScrollingFrame.BackgroundColor3 = Color3.new(0.15, 0.15, 0.15)
  13. ScrollingFrame.Position = UDim2.new(0.08, 0, 0.42, 0)
  14. ScrollingFrame.Size = UDim2.new(0, 296, 0, 388)
  15. local UIGridLayout = Instance.new("UIGridLayout", ScrollingFrame)
  16. UIGridLayout.CellSize = UDim2.new(0,90,0,90)
  17. while wait(1) do
  18. local a = workspace:getDescendants()
  19. local items = {}
  20. local itemframes = ScrollingFrame:getChildren()
  21. for i=1,#itemframes do
  22. if itemframes[i].ClassName == "TextButton" then
  23. itemframes[i]:remove()
  24. end
  25. end
  26. for i=1,#a do
  27. if a[i].Name == "ItemPickupScript" and a[i].Parent:findFirstChild("ClickDetector") then
  28. table.insert(items, a[i].Parent)
  29. end
  30. end
  31. for i=1,#items do
  32. local ItemFrame = Instance.new("TextButton", ScrollingFrame)
  33. ItemFrame.Name = "ItemFrame"
  34. ItemFrame.BackgroundColor3 = Color3.new(1, 1, 1)
  35. ItemFrame.BackgroundTransparency = 0.95
  36. ItemFrame.Size = UDim2.new(0, 100, 0, 100)
  37. ItemFrame.Text = ""
  38. local View = Instance.new("ViewportFrame", ItemFrame)
  39. View.Name = "View"
  40. View.Size = UDim2.new(1,0,1,0)
  41. View.BackgroundTransparency = 1
  42. View.BorderSizePixel = 0
  43. local object = items[i]
  44. local viewportclone = object:Clone()
  45. viewportclone.Parent = View
  46. local cam = Instance.new("Camera", viewportclone)
  47. cam.CameraType = Enum.CameraType.Fixed
  48. local objectPosition = object.Position
  49. local cameraPosition = objectPosition + Vector3.new(0,3,0)
  50. cam.CoordinateFrame = CFrame.new(cameraPosition, objectPosition)
  51. View.CurrentCamera = cam
  52. ItemFrame.MouseButton1Down:connect(function()
  53. if items[i]:findFirstChild("ClickDetector") then
  54. local cpos = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame
  55. wait(0.05)
  56. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = items[i].CFrame
  57. wait(0.1)
  58. fireclickdetector(items[i].ClickDetector)
  59. wait(0.3)
  60. game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = cpos
  61. end
  62. end)
  63. end
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement