Advertisement
iiFlamez

Untitled

Mar 20th, 2020
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.10 KB | None | 0 0
  1.  
  2. local Script = game.Players.LocalPlayer.PlayerGui.HUD.FullScreen.ScrollingFrame.LocalScript;
  3. local gui = Script.Parent
  4. function selection_sort(tab)
  5. --Go through every position in the table
  6. for i = 1, #tab do
  7. --start minimum at current position
  8. local minimum = i
  9. --Go through the remaining elements that need to be sorted
  10. for t = i + 1, #tab do
  11. --compare current element to minimum
  12. if tab[t][2] < tab[minimum][2] then
  13. --t is the new minimum
  14. minimum = t
  15. end
  16. end
  17. --switch minimum with current position
  18. tab[i], tab[minimum] = tab[minimum], tab[i]
  19. end
  20. end
  21.  
  22. function sortbounties(guis)
  23. if guis == nil then
  24. return
  25. end
  26. local pirates = guis:GetChildren()
  27. local organize = {}
  28. local originals = {}
  29. for a,b in next, pirates do
  30. if b:IsA("Frame") then
  31. organize[#organize+1] = {b,b.BountyValue.Value}
  32. end
  33. end
  34. selection_sort(organize)
  35. for i=1,#organize do
  36. local b = organize[#organize-(i-1)]
  37. local tag = b[1]
  38. tag.Position = UDim2.new(1, -250, 0, 20*i)
  39. end
  40. end
  41. --
  42. local players = {}
  43. for a,b in next, game.Players:GetPlayers() do
  44. players[#players+1] = b
  45. end
  46. function Color4(r,g,b)
  47. r = r/255
  48. g = g/255
  49. b = b/255
  50. return Color3.new(r,g,b)
  51. end
  52.  
  53.  
  54. function teamupdate()
  55. local change = false
  56. for a,b in next, game.Players:GetPlayers() do
  57. local tag = gui:FindFirstChild(b.Name,true)
  58. if gui:FindFirstChild(b.Name,true) then
  59. local play = b
  60. local targparent = gui.Civilian
  61.  
  62. if play.Team == game.Teams.Marine or play.TeamColor == game.Teams.Marine.TeamColor then
  63. targparent = gui.Marines
  64. elseif play.Team == game.Teams.Pirate or play.TeamColor == game.Teams.Pirate.TeamColor then
  65. targparent = gui.Pirates
  66. elseif play.Team == game.Teams.Civilian or play.TeamColor == game.Teams.Civilian.TeamColor then
  67. targparent = gui.Civilian
  68. elseif play.Team == game.Teams.Revolutionary or play.TeamColor == game.Teams.Revolutionary.TeamColor then
  69. targparent = gui.Revolutionary
  70. end
  71. if tag.Parent ~= targparent then
  72. tag.Parent = targparent
  73. change = true
  74. end
  75. end
  76. end
  77. if change then
  78. updateguisize()
  79. for a,b in next, gui:GetChildren() do
  80. sortbounties(b)
  81. end
  82. end
  83. end
  84.  
  85. function updateguisize()
  86. --number of players/team changes
  87. local pirates = gui.Pirates:GetChildren()
  88. gui.Marines.Position = UDim2.new(1,-250,0,25 + (20*(#pirates-2)))
  89. local marines = gui.Marines:GetChildren()
  90. gui.Revolutionary.Position = UDim2.new(1,-250,0,45 + (20*((#pirates+#marines-4))))
  91. local rebels = gui.Revolutionary:GetChildren()
  92. gui.Civilian.Position = UDim2.new(1,-250,0,65 + (20*((#pirates+#marines+#rebels-6))))
  93. local civs = gui.Civilian:GetChildren()
  94. end
  95.  
  96. function updatetag(tag)
  97. local play = game.Players:FindFirstChild(tag.Name)
  98. if play:WaitForChild("Crew",5) and play:FindFirstChild("Crew").Value ~= "" then
  99. local info = game:GetService("GroupService"):GetGroupInfoAsync(play.Crew.Value)
  100. tag.ImageButton.Image = info.EmblemUrl
  101. tag.CrewName.Text = info.Name
  102. pcall(function()
  103. tag.CrewRank.Text = play:GetRoleInGroup(info.Id)
  104. end)
  105. tag.ImageButton.Visible = true
  106. else
  107. tag.ImageButton.Visible = false
  108. end
  109. tag.Bounty.TextLabel.Text = play.leaderstats.Bounty.Value
  110. tag.BountyValue.Value = string.gsub(play.leaderstats.Bounty.Value,",","")
  111. tag.TextLabel.Text = play.Name
  112. end
  113.  
  114. function CreatePlayer(Player)
  115. local FakePlayer = Script:WaitForChild("Player"):clone()
  116. FakePlayer.Name = Player.Name
  117. FakePlayer.Bounty.TextLabel.Text = Player:WaitForChild("leaderstats").Bounty.Value
  118. FakePlayer.BountyValue.Value = string.gsub(Player:FindFirstChild("leaderstats").Bounty.Value,",","")
  119. FakePlayer.TextLabel.Text = Player.Name
  120. if Player:WaitForChild("Crew",5) and Player:FindFirstChild("Crew").Value ~= "" then
  121. local GroupInfo = game:GetService("GroupService"):GetGroupInfoAsync(Player.Crew.Value)
  122. FakePlayer.ImageButton.Image = GroupInfo.EmblemUrl
  123. FakePlayer.CrewName.Text = GroupInfo.Name
  124. FakePlayer.CrewRank.Text = Player:GetRoleInGroup(GroupInfo.Id)
  125. FakePlayer.TextLabel.MouseEnter:connect(function()
  126. FakePlayer.CrewRank.Visible = true
  127. end)
  128. FakePlayer.TextLabel.MouseLeave:connect(function()
  129. FakePlayer.CrewRank.Visible = false
  130. end)
  131. FakePlayer.ImageButton.MouseEnter:connect(function()
  132. FakePlayer.CrewName.Visible = true
  133. end)
  134. FakePlayer.ImageButton.MouseLeave:connect(function()
  135. FakePlayer.CrewName.Visible = false
  136. end)
  137. else
  138. FakePlayer.ImageButton.Visible = false
  139. end
  140. Player.leaderstats.Bounty:GetPropertyChangedSignal("Value"):connect(function()
  141. updatetag(FakePlayer)
  142. sortbounties(FakePlayer.Parent)
  143. end)
  144. spawn(function()
  145. Player:WaitForChild("Crew",5);
  146. if not Player:FindFirstChild("Crew") then return end
  147. Player.Crew:GetPropertyChangedSignal("Value"):connect(function()
  148. updatetag(FakePlayer)
  149. end)
  150. end)
  151. Player:GetPropertyChangedSignal("Team"):connect(function()
  152. teamupdate()
  153. end)
  154. if Player:IsDescendantOf(game:GetService("Players")) then
  155.  
  156. local Fired,Return = pcall(function()
  157. return Player:GetRankInGroup(5354780)
  158. end)
  159. if not Fired then
  160. rank = 0;
  161. else
  162. rank = Return;
  163. end
  164. if rank == 235 then
  165. FakePlayer.TextLabel.TextColor3 = Color4(255,58,58) --Yonko
  166. elseif rank == 200 or rank == 255 then -- admiral
  167. FakePlayer.TextLabel.TextColor3 = Color4(102,168,255)
  168. elseif rank == 199 or rank == 190 then -- vice admiral
  169. FakePlayer.TextLabel.TextColor3 = Color4(84,238,255)
  170. elseif rank == 200 or rank == 160 then -- HR MARINE
  171. FakePlayer.TextLabel.TextColor3 = Color4(125,203,255)
  172. elseif rank == 220 then -- fleet admiral
  173. FakePlayer.TextLabel.TextColor3 = Color4(0,59,255)
  174. elseif rank == 225 then -- notable pirate
  175. FakePlayer.TextLabel.TextColor3 = Color4(255,252,140)
  176. elseif rank == 226 then -- Super Nova
  177. FakePlayer.TextLabel.TextColor3 = Color4(255,129,79)
  178. elseif rank == 230 then -- Shichi
  179. FakePlayer.TextLabel.TextColor3 = Color4(212,0,177)
  180. end
  181. end
  182. if Player.Team == game.Teams.Marine then
  183. FakePlayer.Parent = gui.Marines
  184. elseif Player.Team == game.Teams.Pirate then
  185. FakePlayer.Parent = gui.Pirates
  186. elseif Player.Team == game.Teams.Revolutionary then
  187. FakePlayer.Parent = gui.Revolutionary
  188. else
  189. FakePlayer.Parent = gui.Civilian
  190. end
  191. spawn(function()
  192. updateguisize()
  193. end)
  194. sortbounties(FakePlayer.Parent)
  195. end
  196.  
  197.  
  198. for a,b in next, players do
  199. spawn(function()
  200. CreatePlayer(b,true)
  201. end)
  202. end
  203.  
  204. updateguisize()
  205. for a,b in next, gui:GetChildren() do
  206. spawn(function()
  207. sortbounties(b)
  208. end)
  209. end
  210. game.Players.PlayerAdded:connect(function(Player)
  211. if Player and Player:WaitForChild("leaderstats",5) then
  212. CreatePlayer(Player)
  213. end
  214. end)
  215. game.Players.PlayerRemoving:connect(function(Player)
  216. if gui:FindFirstChild(Player.Name,true) then
  217. local tag = gui:FindFirstChild(Player.Name,true)
  218. local tagparent = tag.Parent
  219. tag:Destroy()
  220. updateguisize() --update bounty sizes
  221. sortbounties(tagparent) -- sort their bounties again SHO NAN DA
  222. end
  223. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement