Trosk

PIGGY BEST ITEM SCRIPT

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