• GetEyeTrace for the local entity
    6 replies, posted
Hi. I want to make if statement. If the player looks at entity then do something, but I wanna make it like LOCAL for the entity. How could I do this? function ENT:Think()       if LocalPlayer():GetEyeTrace().Entity:GetClass() == "something" then --DO     end    end
Could you explain more what you're actually trying to do?
Look. if I look on the entity, the image (surface.DrawTexturedRect) starts every time (think) get bigger. But if I spawn for example two entity (same) and look on one entity, the image of the second entity starts to increase too
Use self instead of "something", within entity logic I believe self points to the entity.
I've rewritten. If statement doesn't work if LocalPlayer():GetEyeTrace().Entity:GetClass() == self then
Remove the :GetClass() and compare the two entities directly.
Thanks! The code: if LocalPlayer():GetEyeTrace().Entity == self then -- DO end
Sorry, you need to Log In to post a reply to this thread.