Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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
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? aquathorn321 858 — 9y

1 answer

Log in to vote
0
Answered by
yumtaste 476 Moderation Voter
9 years ago

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

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 XxDarkMiragexX 45 — 9y
0
Hm, I'll test this script and fix it and then give you the new code. yumtaste 476 — 9y
Ad

Answer this question