Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help with recording someone if they have died?

I have this game, and if the gamemode is deathmatch then it checks when a player has died and gives the team a point, but it dosent work. It stops at that playeradded part. Please help

while wait() do
	if repstorage.RoundTag.Value == true then
		if repstorage.GameRound.Value == "Deathmatch" then
			game.Players.PlayerAdded:connect(function(player)
				player.CharacterAdded:connect(function(character)
			        character:WaitForChild("Humanoid")
			        character.Humanoid.Died:connect(function()
			            if character.Humanoid:FindFirstChild("creator") then
			                local tag = character.Humanoid.creator
			                local tColor = player.TeamColor
			                local kColor = tag.Value.TeamColor
			                if not kColor then return end
			                if not tColor then return end
							if tColor ~= kColor then
			                    if kColor == BrickColor.new("Lime green") then
			                        greenscore.Value = greenscore.Value + 1
			                    elseif kColor == BrickColor.new("New Yeller") then
			                        yellowscore.Value = yellowscore.Value + 1
			                    end
			                end
			            end
					end)
		        end)
			end)
		end
	end
end

2 comments

0

output?

0

nothing, the output has no errors

1 answer

✓ Accepted answer

Double check this, as it's been ages since I've done anything since I've worked with events such as PlayerAdded.

However, you're trying to update a scoreboard. The function, as it's being declared inside of the PlayerAdded event, will NOT run until a NEW player joins the game. So the code used to add the point cannot run, as it is withheld inside of the event handler.

This discussion is preserved as it was. New answers, comments, and votes are closed.