• In line of sight
    3 replies, posted
Hello! I've been searching for a script that return true if a player can see a entity. Ent:Visible( target ) does not work at all for some reason, since it was return false when i could see it. I then i tried this one, but it's not reliable: [code] local tracedata = {} tracedata.start = LocalPlayer():EyePos() tracedata.endpos = obj:GetPos() + Vector(0, 0, 32) tracedata.filter = LocalPlayer() local trace = util.TraceLine(tracedata) if trace.Entity:IsWorld() then return false else return true end end [/code]Any suggestions?
Try doing trace.Entity:IsValid()
Why not just if trace.Hit and trace.Entity
tracedata = {} tracedata.start = LocalPlayer():EyePos() tracedata.endpos = obj:GetPos() + Vector(0, 0, 32) tracedata.filter = LocalPlayer() local trace = util.TraceLine(tracedata) if trace.Entity:IsValid() then return ture else return false end Rushed it, might not work
Sorry, you need to Log In to post a reply to this thread.