Having issues here with this code

Output is - 17:09:23.393 - Players.AngeloidX3.Backpack.Lightning.Scripts.ZapServer:29: attempt to index nil with 'TeamColor'

here's the code

if (target.TeamColor ~= player.TeamColor) then

What in the world is going on?

1 comment

0

I'm guessing you're using mouse.Target. The mouse.Target is coming up as nil, because the mouse isn't pointing at anything. Add an if statement making sure the target is not nil. (I would also make sure it is a basepart)