Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- wait(3)
- local connects = {}
- local gui = script.Parent
- function selection_sort(tab)
- --Go through every position in the table
- for i = 1, #tab do
- --start minimum at current position
- local minimum = i
- --Go through the remaining elements that need to be sorted
- for t = i + 1, #tab do
- --compare current element to minimum
- if tab[t][2] < tab[minimum][2] then
- --t is the new minimum
- minimum = t
- end
- end
- --switch minimum with current position
- tab[i], tab[minimum] = tab[minimum], tab[i]
- end
- end
- function sortbounties(guis)
- local pirates = guis:GetChildren()
- local organize = {}
- local originals = {}
- for a,b in pairs(pirates) do
- if b:IsA("Frame") then
- organize[#organize+1] = {b,b.BountyValue.Value}
- end
- end
- selection_sort(organize)
- for i=1,#organize do
- local b = organize[#organize-(i-1)]
- local tag = b[1]
- tag.Position = UDim2.new(1, -250, 0, 20*i)
- end
- end
- --
- local players = {}
- for a,b in pairs(game.Players:GetPlayers()) do
- players[#players+1] = b
- end
- function Color4(r,g,b)
- r = r/255
- g = g/255
- b = b/255
- return Color3.new(r,g,b)
- end
- function teamupdate()
- local change = false
- for a,b in pairs(game.Players:GetPlayers()) do
- local tag = gui:findFirstChild(b.Name,true)
- if tag then
- local play = b
- local targparent = gui.Civilian
- if play.Team == game.Teams.Marine or play.TeamColor == game.Teams.Marine.TeamColor then
- targparent = gui.Marines
- elseif play.Team == game.Teams.Pirate or play.TeamColor == game.Teams.Pirate.TeamColor then
- targparent = gui.Pirates
- elseif play.Team == game.Teams.Civilian or play.TeamColor == game.Teams.Civilian.TeamColor then
- targparent = gui.Civilian
- elseif play.Team == game.Teams.Revolutionary or play.TeamColor == game.Teams.Revolutionary.TeamColor then
- targparent = gui.Revolutionary
- end
- if tag.Parent ~= targparent then
- tag.Parent = targparent
- change = true
- end
- end
- end
- if change then
- updateguisize()
- for a,b in pairs(gui:GetChildren()) do
- sortbounties(b)
- end
- end
- end
- function updateguisize()
- --number of players/team changes
- local pirates = gui.Pirates:GetChildren()
- gui.Marines.Position = UDim2.new(1,-250,0,25 + (20*(#pirates-2)))
- local marines = gui.Marines:GetChildren()
- gui.Revolutionary.Position = UDim2.new(1,-250,0,45 + (20*((#pirates+#marines-4))))
- local rebels = gui.Revolutionary:GetChildren()
- gui.Civilian.Position = UDim2.new(1,-250,0,65 + (20*((#pirates+#marines+#rebels-6))))
- local civs = gui.Civilian:GetChildren()
- end
- function updatetag(tag)
- local play = game.Players:FindFirstChild(tag.Name)
- if play:WaitForChild("Crew").Value ~= "" then
- local info = game:GetService("GroupService"):GetGroupInfoAsync(play.Crew.Value)
- tag.ImageButton.Image = info.EmblemUrl
- tag.CrewName.Text = info.Name
- tag.CrewRank.Text = play:GetRoleInGroup(info.Id)
- tag.ImageButton.Visible = true
- else
- tag.ImageButton.Visible = false
- end
- tag.Bounty.TextLabel.Text = play.leaderstats.Bounty.Value
- tag.BountyValue.Value = string.gsub(play.leaderstats.Bounty.Value,",","")
- tag.TextLabel.Text = play.Name
- end
- local connections = {}
- local tags = {}
- function createplayer(play,b)
- local tag = script:WaitForChild("Player"):clone()
- tag.Name = play.Name
- tag.Bounty.TextLabel.Text = play:WaitForChild("leaderstats").Bounty.Value
- tag.BountyValue.Value = string.gsub(play.leaderstats.Bounty.Value,",","")
- tag.TextLabel.Text = play.Name
- if play:WaitForChild("Crew").Value ~= "" then
- local info = game:GetService("GroupService"):GetGroupInfoAsync(play.Crew.Value)
- tag.ImageButton.Image = info.EmblemUrl
- tag.CrewName.Text = info.Name
- tag.CrewRank.Text = play:GetRoleInGroup(info.Id)
- tag.TextLabel.MouseEnter:connect(function()
- tag.CrewRank.Visible = true
- end)
- tag.TextLabel.MouseLeave:connect(function()
- tag.CrewRank.Visible = false
- end)
- tag.ImageButton.MouseEnter:connect(function()
- tag.CrewName.Visible = true
- end)
- tag.ImageButton.MouseLeave:connect(function()
- tag.CrewName.Visible = false
- end)
- else
- tag.ImageButton.Visible = false
- end
- play.leaderstats.Bounty.Changed:connect(function()
- updatetag(tag)
- sortbounties(tag.Parent)
- end)
- play.Crew.Changed:connect(function()
- updatetag(tag)
- end)
- play.Changed:connect(function(chngd)
- --probably team changed
- if chngd == "TeamColor" or chngd == "Team" then
- teamupdate()
- end
- end)
- local rank = play:GetRankInGroup(3159910)
- if rank == 235 then
- --YONKO SPOTTED OMG :O
- tag.TextLabel.TextColor3 = Color4(255,58,58)
- elseif rank == 200 or rank == 255 then -- admiral
- tag.TextLabel.TextColor3 = Color4(102,168,255)
- elseif rank == 199 or rank == 190 then -- vice admiral
- tag.TextLabel.TextColor3 = Color4(84,238,255)
- elseif rank == 200 or rank == 160 then -- HR MARINE
- tag.TextLabel.TextColor3 = Color4(125,203,255)
- elseif rank == 220 then -- fleet admiral
- tag.TextLabel.TextColor3 = Color4(0,59,255)
- elseif rank == 225 then -- notable pirate
- tag.TextLabel.TextColor3 = Color4(255,252,140)
- elseif rank == 226 then -- Super Nova
- tag.TextLabel.TextColor3 = Color4(255,129,79)
- elseif rank == 230 then -- Shichi
- tag.TextLabel.TextColor3 = Color4(212,0,177)
- end
- if play.Team == game.Teams.Marine or play.TeamColor == game.Teams.Marine.TeamColor then
- tag.Parent = gui.Marines
- elseif play.Team == game.Teams.Pirate or play.TeamColor == game.Teams.Pirate.TeamColor then
- tag.Parent = gui.Pirates
- elseif play.Team == game.Teams.Revolutionary or play.TeamColor == game.Teams.Revolutionary.TeamColor then
- tag.Parent = gui.Revolutionary
- else
- tag.Parent = gui.Civilian
- end
- b = b or false
- if b == false then
- updateguisize()
- sortbounties(tag.Parent)
- end
- end
- for a,b in pairs(players) do
- createplayer(b,true)
- end
- updateguisize()
- for a,b in pairs(gui:GetChildren()) do
- sortbounties(b)
- end
- game.Players.PlayerAdded:connect(function(play)
- wait(1)
- if play then
- createplayer(play)
- end
- end)
- game.Players.PlayerRemoving:connect(function(play)
- if gui:findFirstChild(play.Name,true) then
- local tag = gui:findFirstChild(play.Name,true)
- local tagparent = tag.Parent
- tag:Destroy()
- updateguisize() --update bounty sizes
- sortbounties(tagparent) -- sort their bounties again SHO NAN DA
- end
- end)
Add Comment
Please, Sign In to add comment