Detecting when a prop has been "used"?

How would I go about doing this? PlayerUse does not work with props.



local ent = FindMetaTable("Entity")

function ent:Use(user)
    if self:GetClass() == "prop_physics" then
        --code
    end
end



might work

Try this.

[lua]
function PropTrace(ply, key)
if key == IN_USE then
local tr = util.TraceLine({start = ply:EyePos(), endpos = ply:EyePos() + ply:EyeAngles():Forward() * 120, filter = ply})
if IsValid(tr.Entity) and tr.Entity:GetClass() == “prop_physics” then
tr.Entity:SetColor(Color(255, 0, 0, 255))
end
end
end

hook.Add(“KeyPress”, “stuff”, PropTrace)
[/lua]