Removing Entity On Touch

Well, a new issue has occurred. I was trying to make it so that whenever you ran-over a entity it would remove, but nothing happens instead, and there is also no error.

Code:

[lua]
function Touching()
if ( bubble:IsValid() and bubble:IsPlayer() ) then
bubble:remove( )
end
end
hook.Add(“StartTouch”,“Touch”, Touching)
[/lua]

Ideas :|?

Well, for one you’re trying to remove a player…
For two, bubble will return nil.
[lua]
function ENT:Touch( hitEnt )
if ( hitEnt:IsValid() and hitEnt:IsPlayer() ) then
self:Remove()
end
end
[/lua]

Bubble is the ENT i’m trying to remove & it already exists in the script, and when I try your code I get the error of:



attempt to index global 'ENT' (a nil value)


If your getting that error then your not putting it in the right place.

That specific code goes into teh entity itself.

Thanks, I’ve got it working now.