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

How do I make a Team door for my infection game?

Asked by 4 years ago
Edited 4 years ago

I wanna make a team only door like so if someone walks up to the door it makes the other team cant go at the same time has him also can you fix the script

01local AlloweedColor = "Really Blue"
02local DeniedColor = "Lime green"
03script.Parent.Touched:Connect(function(hit)
04    local player = game.Players:GetPlayerFromCharacter(hit.Parent)
05    if player.TeamColor == AlloweedColor then
06        script.Parent.Transparency = 1
07        script.Parent.CanCollide = false
08    elseif player.TeamColor == DeniedColor then
09        hit.Parent.Humanoid.Health = 0
10    end
11end)

1 answer

Log in to vote
1
Answered by 4 years ago

Unfortunately, BrickColor's don't seem to be able to be compared with strings, so on line 5 do:

1if player.TeamColor == BrickColor.new(AlloweedColor) then

and for line 8 do:

1elseif player.TeamColor == BrickColor.new(DeniedColor) then
0
AloweenColor A_Mp5 222 — 4y
0
Red Reed Bird it dosent work Workspace.Part.Script:5: attempt to index nil with 'TeamColor' SpriteGamerHD 47 — 4y
Ad

Answer this question