CastMORay: attempt to index Ray failed?
Mmk, so I'm making a slightly clunky weapon to try my hand at some of this attachable scripting. I've got almost everything finished, but also being my first attempt at casting a MORay, I seem to have encountered a problem.
Code:
if not self.Parent.HFlipped then
self.XVect = Vector(100, 0);
self.Ray = SceneMan:CastMORay(self.Pos,self.XVect,0,0,true,2);
if self.Ray:IsOfActor() and self.Ray ~= 255 then --error occurs here
self.Target = self.Ray:GetRootMOID();
if self.Target.Team ~= self.Team and self.Ray ~= 255 then
hit.Pos = self.Target.Pos;
MovableMan:AddParticle(hit);
end
end
This is the problem code. An error occurs at the line with the comment. "Attempt to index field 'Ray''" Any insight?