I am making a script to change the player's team when they die, and using the .Died function on the Humanoid to do so. I do not get any errors, but when the computer gets to this part in the script, the player's team changes to tu even though they didn't die.(All of these teams are defined in an earlier part of the script) I don't know why this is happening but here's my code, which is in a server script, but I have filtering enabled off so I should be able to use the LocalPlayer command. (I know I should have filtering enabled on but I am just trying something with it off.)
while true do
local plr = game.Players.LocalPlayer.Character.Humanoid
local player = game.Players.LocalPlayer
if plr.Died then
if player.Team == t1 or player.Team == t2 or player.Team == t3 or player.Team == t4 then
player.Team = tu
end
end
wait(2)
end
Thank you! Let me know if you need more information.

1 comment
^