LocalScript:
game.StarterGui:SetCoreGuiEnabled("PlayerList", false)
local plr = game.Players.LocalPlayer
local gui = script.Parent
local PlayerListFrame = gui:WaitForChild('PlayerListFrame')
local PlayerListUpdate = game.ReplicatedStorage:WaitForChild('PlayerListUpdate')
function UpdatePlayerList()
for i,v in ipairs(game.Players:GetPlayers()) do
if not PlayerListFrame:findFirstChild(v.Name) then
local kills2 = v.leaderstats.RoundKills.Value
local killstreak2 = v.leaderstats.Killstreak.Value
local I = Instance.new("Frame")
I.Name = v.Name
I.Parent = PlayerListFrame
I.Style = "DropShadow"
-- NAME
local T = Instance.new("TextLabel")
T.Name = "Username"
T.BackgroundTransparency = 1
T.Text = v.Name
T.Parent = I
T.Size = UDim2.new(0, 165, 0, 35)
T.Position = UDim2.new(0, 10, 0, 0)
if v.Name == plr.Name then
T.TextColor3 = Color3.fromRGB(0, 200, 255)
else
T.TextColor3 = Color3.new(1, 1, 1)
end
T.TextStrokeColor3 = Color3.new(0, 0, 0)
T.TextStrokeTransparency = 0.5
T.TextXAlignment = "Left"
T.Font = "SourceSansBold"
T.TextSize = 20
-- ROUND KILLS
local K = Instance.new("TextLabel")
K.Name = "RoundKills"
K.BackgroundTransparency = 1
K.Text = kills2
K.Parent = I
K.Size = UDim2.new(0, 20, 0, 35)
K.Position = UDim2.new(0, 155, 0, 0)
K.TextColor3 = Color3.new(1, 1, 1)
K.TextStrokeColor3 = Color3.new(0, 0, 0)
K.TextStrokeTransparency = 0.5
K.TextXAlignment = "Right"
K.Font = "SourceSansBold"
K.TextSize = 20
-- KILL STREAK
local KS = Instance.new("TextLabel")
KS.Name = "KillStreak"
KS.BackgroundTransparency = 1
KS.Text = killstreak2
KS.Parent = I
KS.Size = UDim2.new(0, 20, 0, 35)
KS.Position = UDim2.new(0, 167, 0, 0)
KS.TextColor3 = Color3.new(255,0,0)
KS.TextStrokeColor3 = Color3.new(0, 0, 0)
KS.TextStrokeTransparency = 0.5
KS.TextXAlignment = "Right"
KS.Font = "SourceSansBold"
KS.TextSize = 20
-- AVATAR IMAGE
P = Instance.new("ImageLabel")
P.ScaleType = Enum.ScaleType.Slice
P.Name = "AvatarImage"
P.BackgroundTransparency = 1
P.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=500&y=500&Format=Png&username="..v.Name
P.Parent = I
P.Size = UDim2.new(.25,0,1.25,0)
P.Position = UDim2.new(-0.25, 0, 0, 0)
else
local kills2 = v.leaderstats.RoundKills.Value
local killstreak2 = v.leaderstats.Killstreak.Value
local PlayerFrame = PlayerListFrame:findFirstChild(v.Name)
PlayerFrame:WaitForChild('KillStreak').Text = killstreak2
PlayerFrame:WaitForChild('RoundKills').Text = kills2
end
end
end
game.Players.PlayerAdded:connect(function(plr)
UpdatePlayerList()
end)
UpdatePlayerList()
PlayerListUpdate.OnClientEvent:connect(function(args)
if args['Action'] == 'Update' then
UpdatePlayerList()
end
end)
Server Script:
local PlayerListUpdate = Instance.new('RemoteEvent')
PlayerListUpdate.Name = 'PlayerListUpdate'
PlayerListUpdate.Parent = game.ReplicatedStorage
local Vals = {}
game.Players.PlayerAdded:connect(function(plr)
local ls = Instance.new('IntValue')
ls.Name = 'leaderstats'
local kills = Instance.new('IntValue',ls)
kills.Name = 'RoundKills'
local killstreak = Instance.new('IntValue',ls)
killstreak.Name = 'Killstreak'
ls.Parent = plr
Vals[plr.Name] = {
kills:GetPropertyChangedSignal('Value'):connect(function()
PlayerListUpdate:FireAllClients({
['Action'] = 'Update',
})
end),
killstreak:GetPropertyChangedSignal('Value'):connect(function()
PlayerListUpdate:FireAllClients({
['Action'] = 'Update',
})
end)
}
end)
game.Players.PlayerRemoving:connect(function(plr)
for i,v in ipairs(Vals[plr.Name]) do
v:Disconnect()
end
Vals[plr.Name] = nil
end)
This should work for what you’re wanting! Hope it helps!