Hi, i made a script where it's supposed to change the player's team whenever he dies, but it doesn't work. Can someone help? Main Handler
local function playerDied(player)
print("Returning "..player.Name.." to lobby.")
local plr = game.Players:FindFirstChild(player.Name)
plr.Team = lteam
end
game.ReplicatedStorage.Death.OnServerEvent:Connect(playerDied)
Client Handler
local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
while wait() do
if hum.Health == 0 then
game.ReplicatedStorage.Death:FireServer()
end
end

1 comment
try use TeamColor