I'm making a terminal for a clan fort and when a defender touches it I want something to happen that's different from when a raider touches it. I have a lot more code, but I cut it out to just this because this is the problem area.
Does anyone know why this throws nil?
Code -
script.Parent.Touched:connect(function(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent).TeamColor == BrickColor.new("Earth green") and hit.Parent.Humanoid.Health > 0 then
print 'defender touched'
deftouched = true

2 comments
Output.. What does it all say?
Sorry, it says "Workspace.terminal.script: 12: attempt to index a nil value"