How do I get player kills via remote?

Hey, I wanted to ask how do I make a remote that will ask the server for kills of each player, I could do it myself but I’m not sure how to do it effectively. Player kills are stored in a folder in ServerScriptService.
Any ideas?

1 Like

Why not have a leaderstats folder in every player object, and have an IntValue named Kills inside that folder. Then in you script (local script i think), you can easily track how many kills a player has.
Code example:

local player = game.Players.LocalPlayer
local leaderstats = player:WaitForChild("leaderstats")

local Kills = leaderstats.Kills
local TextLabel = script.Parent

TextLabel.Text = "Kills: "..Kills.Value

Kills:GetPropertyChangedSignal("Value"):Connect(function()
   TextLabel.Text = "Kills: "..Kills.Value
end)

Couldn’t an exploiter delete that folder and break everybodys leaderboard?

Exploiters cant break everybody’s leaderboard, since that is not possible for them to do so. They can only change their own leaderstats, they can’t delete anything for other people. Because they can only make changes locally, not server wide. So if they delete the leaderstats folder, they deleted it only for themselves.

And what if they changed the IntValue in somebodys player folder? Would that replicate?
Or what about their folder?

No, nothing happens to the other player’s folder or Values if exploiters even try to do anything to it.

Okay, thank you. :slight_smile:

1 Like

You should create the leaderstats folder on a server script.
Here is a code that creates the leaderstats folder and the Kills Value (must be in ServerScriptService):

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(plr)
   local leaderstats = Instance.new("Folder")
   leaderstats.Name = "leaderstats"
   leaderstats.Parent = plr

   local Kills = Instance.new("IntValue")
   Kills.Name = "Kills"
   Kills.Value = 0
   Kills.Parent = leaderstats
end)

Yep, I already did that. Thanks!

1 Like

Okay, no problem!
(30 letters)