Hi, in my game when you die, your team gets changed, but it doesn't work, i don't know what's wrong with the script. This is in a normal script
local teams = game:GetService("Teams")
game:GetService('Players').PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function()
print(player.Name .. " has died!")
player.Team = teams:FindFirstChild("Lobby")
print('fire')
if player.Team == teams:FindFirstChild("Juggernaut") then
game.ReplicatedStorage.Values.JuggernautPlayers.Value = game.ReplicatedStorage.Values.JuggernautPlayers.Value-1
elseif player.Team == teams:FindFirstChild("Sheriff") then
game.ReplicatedStorage.Values.SheriffPlayers.Value = game.ReplicatedStorage.Values.SheriffPlayers.Value-1
end
end)
end)
end)

2 comments
Both prints are there, but team doesn't change.
Fix your indentation please. Perhaps add more print that would to see what if statement is evaluated to true (if any). Other than that, check output for errors.