I want to change the player's team to Neutral after it dies. Here is the script, but it's not working.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		character:WaitForChild("Humanoid").Died:Connect(function()
			if player.inGround.Value == true then
				player.Team = game.Teams.Neutral
			end
		end)
	end)
end)

Please tell me what is the problem in this script. The 'inGround' value above was true when I tested this.

5 comments

0

I do not use Teams but all code I have seen swaps teams by setting the BrickColour for the given team

0

also == true is redundant

0

I have tried swapping the team with the TeamColor but it doesn't work too! Can you help me find what is the problem here?

0

Oh don't worry I managed to get it to work! I removed the ==true statement and it worked fine!

0

write solved in the title