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

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

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

local AlloweedColor = "Really Blue"
local DeniedColor = "Lime green"
script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	if player.TeamColor == AlloweedColor then
		script.Parent.Transparency = 1
		script.Parent.CanCollide = false
	elseif player.TeamColor == DeniedColor then
		hit.Parent.Humanoid.Health = 0
	end
end)

1 answer

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

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

and for line 8 do:

elseif player.TeamColor == BrickColor.new(DeniedColor) then

2 comments

0

AloweenColor

0

Red Reed Bird it dosent work Workspace.Part.Script:5: attempt to index nil with 'TeamColor'

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