Advertisement
D_rawest16

Untitled

Feb 17th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.87 KB | None | 0 0
  1. local Player = game:GetService("Players")
  2. local background = script.Parent:WaitForChild("Background")
  3. local outline = background.Frame:WaitForChild("Player")
  4. local bounty = outline:WaitForChild("bounty")
  5. local crewlogo = outline:WaitForChild("crewlogo")
  6. local playername = outline:WaitForChild("playername")
  7.  
  8. -----------------------
  9.  
  10. local PlayerData = game.Players.LocalPlayer:WaitForChild("Backpack")
  11. local Bounty = PlayerData:WaitForChild("Bounty")
  12. local CrewLogo = PlayerData:WaitForChild("CrewLogoID")
  13. ----------------------------
  14.  
  15. local players_table = {}
  16.  
  17. local dir = "Out"
  18. local style = "Quad"
  19. local dur = 0.5
  20.  
  21. local function cleanup(outlines)
  22.     repeat
  23.         wait()
  24.     until outlines.Position.X.Offset == 400
  25.     outlines:Destroy()
  26. end
  27.  
  28.  
  29. local function remove(leaving)
  30.     if leaving then
  31.         players_table[leaving] = nil
  32.         local slot = background.Frame:FindFirstChild(leaving)
  33.         slot:TweenPosition(UDim2.new(0,400,0,slot.Position.Y.Offset),dir,style,dur,true)
  34.        
  35.         local cor = coroutine.wrap(cleanup)
  36.         cor(slot)
  37.     end
  38. end
  39.  
  40. local function add()
  41.     for i,v in pairs(game.Players:GetPlayers()) do
  42.                        
  43.             local slot = outline:Clone()
  44.             slot.Visible = true
  45.             slot.Name = v.Name
  46.             slot.playername.TextLabel.Text = v.Name
  47.             slot.bounty.TextLabel.Text = v.Backpack.Bounty.Value
  48.             slot.crewlogo.ImageLabel.Image = ""..v.Backpack.CrewLogo.Value
  49.            
  50.             slot.Parent = background.Frame
  51.         end
  52.     end
  53. end
  54.  
  55.  
  56. local function adjust(leaving)
  57.     add()
  58.     remove(leaving)
  59.     local count = 0
  60.     for key,value in pairs(players_table) do
  61.         count = count + 1
  62.         local slot = background.Frame:FindFirstChild(key)
  63.    
  64.         local ypos = 10 + (40+2)*(count-1)
  65.         slot:TweenPosition(UDim2.new(0.01,0,0,ypos),dir,style,dur,true)
  66.     end
  67. end
  68.  
  69.  
  70.  
  71. Player.PlayerAdded:Connect(function()
  72.     adjust(nil)
  73. end)
  74.  
  75. Player.PlayerRemoving:Connect(function(leaving)
  76.     adjust(leaving.Name)
  77. end)
  78.  
  79. adjust()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement