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

Why won't this team door script work?

Asked by 9 years ago

Well, I'm trying to make a team door but this script doesn't seem to work...

script.Parent.Touched:connect(function(part)
    print("Wow")
    local h = part.Parent:FindFirstChild("Humanoid")
    if h == nil then return end
    print("1")
    local char = part.Parent
    local player = game.Players:FindFirstChild(char.Name)
    if player == nil then return end
    print("2")
    if not player.TeamColor == BrickColor.new("Bright red") then
        print("Wow!")
        h.Health = 0
    end
end)

I put in print functions, but Wow, 1 and 2 printed out. The problem is, I was in blue team, and I never got killed. Why?

1 answer

Log in to vote
1
Answered by
Hero_ic 502 Moderation Voter
9 years ago

change the if not player.TeamColor == BrickColor.new("Bright red") then to

if player.TeamColor ~= BrickColor.new("Bright red") then

~if this helped please (up vote) accept :D KIHeros

Ad

Answer this question