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

How can i call out the player's Character from a team?

Basically, i'm just trying to call out the character from each player on the blue team, but haven't been able to script a solid working script. Does anyone know how to do that? My failed attempt is shown below...

Script:

local BlueTeamPlayers = game.Teams.Blue:GetPlayers()
local BlueHumanoid = BlueTeamPlayers.Character:findFirstChild("Humanoid")

function DeathOfBlueTeam()
	print('1 player death from blue team...just a test')
end

BlueHumanoid.Died:connect(DeathOfBlueTeam)

Thanks for your time! ;)

1 answer

✓ Accepted answer

EDIT: Alright, here's the code. I fixed it and added some better explaination.

game.Players.PlayerAdded:connect(function(Player)--hook this up to every player that joins
	Player.CharacterAdded:connect(function(Character)--hook this up to their character
		local Humanoid = Character:WaitForChild("Humanoid")--wait for their humanoid
		Humanoid.Died:connect(function(Died)--hook this up to the humanoid's death
			if Player.TeamColor == BrickColor.Blue() then--check team
				print('Someone died on the blue team D:')
			end
		end)
	end)
end)

1 comment

0

Thanks so much!

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