Samuel1234

Prison Royal GUI

May 31st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. -- ////////////// Prison Royale GUI /////// By: Chilled //////
  2.  
  3. local Plr = game:GetService("Players").LocalPlayer
  4.  
  5. local GUI = game:GetObjects("rbxassetid://1086440185")[1]
  6. GUI.Parent = game:GetService("CoreGui")
  7.  
  8. --local GUI = script.Parent:WaitForChild("ScreenGui")
  9.  
  10. local Search = GUI:WaitForChild("Holdr").Main.Search
  11. local Scroll = GUI:WaitForChild("Holdr").Main.Scroll
  12.  
  13. local Loot = workspace.Loot
  14.  
  15. -- //////////////////////////////////////////////////////
  16.  
  17. local Pos = 0
  18. local SPos = 0
  19.  
  20. local Objects = {}
  21.  
  22. local print = function(Str)
  23. print("[PR] - " .. Str)
  24. end
  25.  
  26. local ClearObjects = function()
  27. local k = 1
  28. while Objects[k] do
  29. Objects[k] = nil
  30. k = k + 1
  31. end
  32. Objects = {}
  33. end
  34.  
  35. local ResetGUI = function()
  36. Pos = 0
  37. SPos = 0
  38. Scroll.CanvasSize = UDim2.new(0, 0, 0, 0)
  39. for i,v in pairs(Scroll:GetChildren()) do
  40. v:Destroy()
  41. end
  42. end
  43.  
  44. local DefaultSearch = function()
  45. ResetGUI()
  46. ClearObjects()
  47. local Tag = 1
  48. for i,v in pairs(Loot:GetChildren()) do
  49. table.insert(Objects, {Tag, v})
  50. local x = Instance.new("TextButton", Scroll)
  51. x.BackgroundColor3 = Color3.fromRGB(38, 38, 38)
  52. x.BorderColor3 = Color3.fromRGB(255, 255, 255)
  53. x.Position = UDim2.new(0, 0, 0, Pos)
  54. x.Size = UDim2.new(1, 0, 0, 20)
  55. x.Name = Tag
  56. x.Text = v.Name
  57. x.TextScaled = true
  58. x.TextColor3 = Color3.fromRGB(255, 255, 255)
  59. x.TextXAlignment = Enum.TextXAlignment.Left
  60. Scroll.CanvasSize = Scroll.CanvasSize + UDim2.new(0, 0, 0, SPos)
  61.  
  62. x.MouseButton1Down:connect(function()
  63. for i,v in pairs(Objects) do
  64. if tostring(Objects[i][1]) == x.Name then
  65. Objects[i][2]:MoveTo(Plr.Character.Head.Position)
  66. end
  67. end
  68. end)
  69.  
  70. Pos = Pos + 24
  71. SPos = SPos + 2
  72. Tag = Tag + 1
  73. end
  74. end
  75.  
  76. DefaultSearch()
  77.  
  78. Search.FocusLost:connect(function(k)
  79. if k then
  80. if Search.Text:match("%w") then
  81. ResetGUI()
  82. ClearObjects()
  83. local Tag = 1
  84. for i,v in pairs(Loot:GetChildren()) do
  85. if (v.Name:lower():find(Search.Text:lower())) then
  86. table.insert(Objects, {Tag, v})
  87. local x = Instance.new("TextButton", Scroll)
  88. x.BackgroundColor3 = Color3.fromRGB(38, 38, 38)
  89. x.BorderColor3 = Color3.fromRGB(255, 255, 255)
  90. x.Position = UDim2.new(0, 0, 0, Pos)
  91. x.Size = UDim2.new(1, 0, 0, 20)
  92. x.Name = Tag
  93. x.Text = v.Name
  94. x.TextScaled = true
  95. x.TextColor3 = Color3.fromRGB(255, 255, 255)
  96. x.TextXAlignment = Enum.TextXAlignment.Left
  97. Scroll.CanvasSize = Scroll.CanvasSize + UDim2.new(0, 0, 0, SPos)
  98.  
  99. x.MouseButton1Down:connect(function()
  100. for i,v in pairs(Objects) do
  101. if tostring(Objects[i][1]) == x.Name then
  102. Objects[i][2]:MoveTo(Plr.Character.Head.Position)
  103. end
  104. end
  105. end)
  106.  
  107. Pos = Pos + 24
  108. SPos = SPos + 2
  109. Tag = Tag + 1
  110. end
  111. end
  112. else
  113. DefaultSearch()
  114. end
  115. end
  116. end)
  117.  
  118. -- ///////////////////////////////////////////
  119.  
  120. print("Prison Royale GUI Loaded")
  121. print("Created by Chilled")
Add Comment
Please, Sign In to add comment