I have no idea on how to make a player that changes his teams, doesnt matter how, just when he gets to other team gets killed, or somehow reseted/refreshe, any help for that ?
✓ ANSWER ACCEPTED
How can I make player "Die" or get killed after he changes his team ?
2 answers
✓ Accepted answer
Hey, you could loop between the teams and connect whenever a player leaves (or joins, your choice) a team and kill them.
for i,v in next, game:GetService('Teams'):GetChildren() do
v.PlayerRemoved:Connect(function(plr)
plr:LoadCharacter()
end)
end
I think the best way to do that is to use an event, grab their character and damage the humanoid/kill the player.
Something like this could be a good answer to your problem.
--team refers to the teams within your game
Team.PlayerRemoved:Connect(function(player)
local character = player.Character
if character then
character:BreakJoints()
end
end)
- you could also do it like this if you find it better
Team.PlayerRemoved:Connect(function(player)
local character = player.Character
if character then
character.Humanoid:TakeDamage(character.Humanoid.MaxHealth)
end
end)
but both should work just fine
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
Thank you, Works!