Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why isn't the player being switched to the oppisite team on death?

I have a script that switches a player from the "Human" team to the "Zombie" team upon death. Now, this use to work a while back, but now I think it's a bit outdated. I can't seem to spot anything funny about it.

player = script.Parent.Parent.Parent
Humanoid = player.Charcter:FindFirstChild("Humanoid")
Survivor = game.Teams["Survivors"]
Zombie = game.Teams["Zombies"]

function onDeath()
	if player.TeamColor == Survivor.TeamColor then
		player.TeamColor = Zombie.TeamColor
		print("A player has turned")
	elseif player.TeamColor == Zombie.TeamColor then
		print("Already a zombie")
	end
end

Humanoid.Died:connect(onDeath)

1 comment

1

I'm not very experienced with teams, but maybe it's because you're referencing the color of the teams themselves using TeamColor when you should be using Color? Otherwise, it might be because you're referencing Teams as game.Teams instead of getting the service?

1 answer

The TeamColor value is a BrickColor3 value. You need to do BrickColor3.new(Survivor/Zombie.TeamColor).

2 comments

0

Which lines would I put this in, because no matter what I change to make it a brickcolor3 value doesn't work. And the script itself says BrickColor3 doesn't exsists

0

Hm, I'll test this script and fix it and then give you the new code.

This discussion is preserved as it was. New answers, comments, and votes are closed.