Hello,
This is my first time posting here, apologies if I’m doing this wrong, or have this formatted incorrectly.
I’ve created a custom player list that will display a user’s: Avatar Image, Name, RoundKills, KillStreak.
Unfortunately, while the RoundKills and KillStreak, which are leaderstats Values, do update in real time, the stats are not updating for the correct player. For example: Player 1 scored a kill, yet on Player1’s screen it shows Player3 as having done this, while on Player2’s screen, it shows that Player1 did. What I’d like to do is make it to where the RoundKills/Killstreak update for the correct player, and still do so in real time for everyone else.
Here’s an image showing this:
My custom player list is created by this local script code inside a ScreenGui, and has the lines where the RoundKills & Killstreak display,
CODE:
game.StarterGui:SetCoreGuiEnabled("PlayerList", false) local plr = game.Players.LocalPlayer local kills = plr.leaderstats.Roundkills.Value local killstreak = plr.leaderstats.Killstreak.Value local Avatarurl = "http://www.roblox.com/Thumbs/Avatar.ashx?x=500&y=500&Format=Png&username=" local gui = script.Parent while wait(1) do for _,plr in pairs (game.Players:GetChildren()) do if script.Parent.Holder:FindFirstChild(plr.Name) then else local kills2 = plr.leaderstats.Roundkills.Value local killstreak2 = plr.leaderstats.Killstreak.Value I = Instance.new("Frame") I.Name = plr.Name I.Parent = script.Parent.Holder I.Style = "DropShadow" -- NAME T = Instance.new("TextLabel") T.Name = "Username" T.BackgroundTransparency = 1 T.Text = plr.Name T.Parent = I T.Size = UDim2.new(0, 165, 0, 35) T.Position = UDim2.new(0, 10, 0, 0) if plr.Name == game.Players.LocalPlayer.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 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 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 = "Slice" P.Name = "AvatarImage" P.BackgroundTransparency = 1 P.Image = Avatarurl..plr.Name P.Parent = I P.Size = UDim2.new(.25,0,1.25,0) P.Position = UDim2.new(-0.25, 0, 0, 0) game:GetService("ReplicatedStorage"):WaitForChild("KillUpdate").OnClientEvent:Connect(function(value) K.Text = value end) game:GetService("ReplicatedStorage"):WaitForChild("KillStreakUpdate").OnClientEvent:Connect(function(value) KS.Text = value end) end end end
I have this bit of code in my Leaderstats script in ServerScriptStorage:
Roundkills.Changed:Connect(function() game:GetService("ReplicatedStorage"):WaitForChild("KillUpdate"):FireClient(Player, Roundkills.Value) end) print("RoundKills check") Killstreak.Changed:Connect(function() game:GetService("ReplicatedStorage"):WaitForChild("KillStreakUpdate"):FireClient(Player, Killstreak.Value) end) print("Killstreak check")
And finally in my DeathScript I have this bit of code that updates the RoundKills and KillStreak stats in the first place after a player is killed, just in case something here need to be done:
leaderstats.Roundkills.Value = leaderstats.Roundkills.Value + 1 leaderstats.Killstreak.Value = leaderstats.Killstreak.Value + 1
I’ve tried messing with this several ways, and have yet to get it correct. I’ll be the first to admit that my knowledge of remote events is shakey and I wonder if that’s where the problem is?
Thank you!