Hello!
I have a Custom PlayerList, which displays a user's avatar, name, kills for that round, and a killstreak. So far, all the things work. Slight problem - the round kills/killstreak display only updates when the player dies/respawns, instead of as it happens.
There is a RemoteEvent inside ReplicatedStorage labeled as KillUpdate
Here's the LocalScript inside the ScreenGui under StarterGui for the Custom Player List:
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=" 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 -- 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 Stuff -- AVATAR IMAGE Stuff -- REMOTE EVENT CALL: local event = game:GetService("ReplicatedStorage"):WaitForChild("KillUpdate") K.Changed:connect(function() local amountOfKills = K.Text event:FireServer(amountOfKills) print("Test1") end) end end end
Script inside ServerScriptStorage:
local event = game:GetService("ReplicatedStorage"):WaitForChild("KillUpdate") event.OnServerEvent:connect(function(player,amountOfKills) player.leaderstats.Roundkills.Value = amountOfKills end)
You can have an event fire everytime your kills/killstreak changes, here's an example but you're gonna have to change it to fit your script. also you need to make an event and put it in replicated storage and call it KillUpdate local script
local event=game:GetService("ReplicatedStorage"):WaitForChild("KillUpdate") gui.TextLabel.Changed:connect(function() local amountOfKills=gui.TextLabel.Text event:FireServer(amountOfKills) end)
server script
local event=game:GetService("ReplicatedStorage"):WaitForChild("KillUpdate") event.OnServerEvent:connect(function(player,amountOfKills) player.leaderstats.Kills.Value=amountOfKills end)
If you have any questions let me know. EDIT Here's your server script (make a remote event called GUIKillUpdate and put it in replicated storage)
local event = game:GetService("ReplicatedStorage"):WaitForChild("KillUpdate") local client=game:GetService("ReplicatedStorage"):WaitForChild("GUIKillUpdate") event.OnServerEvent:connect(function(player,amountOfKills) player.leaderstats.Roundkills.Value = amountOfKills client:FireClient(player,amountOfKills) end)
and in a local script inside the player gui put this
local client=game:GetService("ReplicatedStorage"):WaitForChild("GUIKillUpdate") client.OnClientEvent:connect(function(player,amountOfKills) killtext.Text=amountOfKills --change the killtext to whatever the gui is and make it get to the textlabel end)