Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Player = game:GetService("Players")
- local background = script.Parent:WaitForChild("Background")
- local outline = background.Frame:WaitForChild("Player")
- local bounty = outline:WaitForChild("bounty")
- local crewlogo = outline:WaitForChild("crewlogo")
- local playername = outline:WaitForChild("playername")
- -----------------------
- local PlayerData = game.Players.LocalPlayer:WaitForChild("Backpack")
- local Bounty = PlayerData:WaitForChild("Bounty")
- local CrewLogo = PlayerData:WaitForChild("CrewLogoID")
- ----------------------------
- local players_table = {}
- local dir = "Out"
- local style = "Quad"
- local dur = 0.5
- local function cleanup(outlines)
- repeat
- wait()
- until outlines.Position.X.Offset == 400
- outlines:Destroy()
- end
- local function remove(leaving)
- if leaving then
- players_table[leaving] = nil
- local slot = background.Frame:FindFirstChild(leaving)
- slot:TweenPosition(UDim2.new(0,400,0,slot.Position.Y.Offset),dir,style,dur,true)
- local cor = coroutine.wrap(cleanup)
- cor(slot)
- end
- end
- local function add()
- for i,v in pairs(game.Players:GetPlayers()) do
- local slot = outline:Clone()
- slot.Visible = true
- slot.Name = v.Name
- slot.playername.TextLabel.Text = v.Name
- slot.bounty.TextLabel.Text = v.Backpack.Bounty.Value
- slot.crewlogo.ImageLabel.Image = ""..v.Backpack.CrewLogo.Value
- slot.Parent = background.Frame
- end
- end
- end
- local function adjust(leaving)
- add()
- remove(leaving)
- local count = 0
- for key,value in pairs(players_table) do
- count = count + 1
- local slot = background.Frame:FindFirstChild(key)
- local ypos = 10 + (40+2)*(count-1)
- slot:TweenPosition(UDim2.new(0.01,0,0,ypos),dir,style,dur,true)
- end
- end
- Player.PlayerAdded:Connect(function()
- adjust(nil)
- end)
- Player.PlayerRemoving:Connect(function(leaving)
- adjust(leaving.Name)
- end)
- adjust()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement