Hey,
I need some help with this script. My Players Names show up. The first Players Kills Show up but the second players kills dont show. If I look at it through the Second Player I can see the first players stats change in the Gui but I cant see the second players stats. The second players name shows up but not their kills. Can someone tell me why the kills wont show up? Any help would be greatly appreciated.
Frame = script.Parent.Frame
--Joined Game
local Players = game:GetService("Players")
function onPlayerAdded(player)
--Number Of People Counter
local num = script:FindFirstChild("Players")
num.Value = num.Value + 1
--Position
local Position = num.Value * 0.11
local PlayerName = Instance.new("TextLabel")
PlayerName.Parent = Frame
PlayerName.Text = player.Name
PlayerName.Position = UDim2.new(0, 0, Position, 0)
PlayerName.Size = UDim2.new(1, 0, 0.1, 0)
PlayerName.BackgroundTransparency = 0.6
PlayerName.BackgroundColor3 = Color3.new(0, 0, 0)
PlayerName.TextColor3 = Color3.new(255,255,255)
PlayerName.TextXAlignment = "Left"
Kills = Instance.new ("TextLabel")
Kills.Parent = Frame
Kills.Text = player.leaderstats.Kills.Value
Kills.Position = UDim2.new(0, 0, Position, 0)
Kills.Size = UDim2.new(1, 0, 0.1, 0)
Kills.BackgroundTransparency = 0.6
Kills.BackgroundColor3 = Color3.new(0, 0, 0)
Kills.TextColor3 = Color3.new(255,255,255)
Kills.TextXAlignment = "Right"
RKills = player.leaderstats.Kills
RKills.Changed:connect(function()
Kills.Text = player.leaderstats.Kills.Value
end)
end
--When a player joins, call the onPlayerAdded function
Players.PlayerAdded:connect(onPlayerAdded)
--Call onPlayerAdded for each player already in the game
for _,player in pairs(Players:GetPlayers()) do
onPlayerAdded(player)
end
