--something went wrong with this script, help me fix it door1 = script.Parent Defender = BrickColor.new("Bright green") Raider = BrickColor.new("Fossil") function door(plr) if plr.TeamColor == Defender then door1.Transparency = 1 door1.CanCollide = false wait(2) door1.Transparency = 1 door1.CanCollide = true elseif plr.TeamColor == Raider then door1.Transparency = 1 door1.CanCollide = true r = plr.Name m = Instance.new("Hint") m.Parent = game.Workspace m.Text = r.."Is Trying To Enter The Defender Spawn!" wait(5) m:remove() end end door1.Touched:connect(door)
door1.Touched:Connect(door)
<-- Suggestion, use Connect with a capital C
function door(plr)
the so called plr here isn't actually the player, its whichever part that touches Door1
. To get the actual "plr", its just game.Players:GetPlayerFromCharacter(plr.Parent)
. Only then, the script can detect the TeamColor of the player