blueKills = 0
redKills = 0
for _, player in pairs(game.Players:GetChildren()) do
local kills = player:WaitForChild("GameFolder").Kills.Value
if player.TeamColor == game.Teams.Red.TeamColor then
redKills = redKills + kills
redValue.Value = redKills
elseif player.TeamColor == game.Teams.Blue.TeamColor then
blueKills = blueKills + kills
blueValue.Value = blueKills
end
end
Can anybody help with this deathmatch script. I have it set so whenever a player kills another player, it gives them a 'kill' Now this script checks for the amounts of kills each player on the team has and adds it to their score. However, if a player with say 4 kills leaves the game, it removes their 4 kills from the games points. How can I stop this from happening?

4 comments
Please accept my answer if it helped, or ask any questions.
Doesn't work properly. Firstly, I dont want to remove the kills when a player leaves, the script I have already does that. The problem with using kills.Changed is that when I kill someone it gives the team like 50 kills, and I cant use a debounce because then if someone gets a kill .5 seconds later it wont be counted
why would it give 50 kills? The event is only fired once per change of property, and you're only going to be changing the kills value when they kill someone, +1 each time.
Not sure what your question is. If you want their kills to count even after they leave, then just don't include that second code I put. As for the connect thing, it should only be fired once unless you're doing something wrong.