I still have a hard time understanding specific players on a normal script.
For a fighting game, I have a normal script that gives the killer a point if he/she kills the other opponent. I do know that for other players to be able to see the kills, the script will have to be a normal script.
I’m having lots of trouble understanding how to reset the kill count (leaderboard) for the killed player.
Here is my script that I’m using for the leaderboard.
local Players = game.Players
local Template = Instance.new 'BoolValue'
Template.Name = 'leaderstats'
Instance.new('IntValue', Template).Name = "Kills"
Players.PlayerAdded:connect(function(Player)
wait(1)
local Stats = Template:Clone()
Stats.Parent = Player
Player.CharacterAdded:connect(function(Character)
local Humanoid = Character:FindFirstChild "Humanoid"
if Humanoid then
Humanoid.Died:connect(function()
for i, Child in pairs(Humanoid:GetChildren()) do
if Child:IsA('ObjectValue') and Child.Value and Child.Value:IsA('Player') then
local Killer = Child.Value
if Killer:FindFirstChild 'leaderstats' and Killer.leaderstats:FindFirstChild "Kills" then
local Kills = Killer.leaderstats.Kills
Kills.Value = Kills.Value + 1
end
return -- Only one player can get a KO for killing a player. Not 2, not 3. Only one.
end
end
end)
end
end)
end)

3 comments
what do you mean?
im trying to do (Kills.Value = Kills.Value - 5) if the player that got killed from the sword, then they lose 5 points
but i dont know what to do