Advertisement
iiFlamez

Untitled

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