will this work?

yo! so, does this code work?


hook.Add( "PhysgunPickup", "AntiPropkil", function( ent )
	
	ShouldCollide = False

end )

I’m pretty positive this will not work… but ohh well.

Why don’t you just test it out…

Only if you have a ShouldCollide hook that uses your variable ‘ShouldCollide’ to determine whether it should collide

You should really get a test server, its alot easier

Away on vacation bro sorry.

Lua is case sensitive. False should be false.

Also, AntiPropkil should probably be AntiPropKill for the sake of spelling… try something like this:


hook.Add( "PhysgunPickup", "AntiPropKill", function( ent )
	
	ent:SetCollisionGroup( COLLISION_GROUP_WEAPON )

end )

COLLISION_GROUP_WEAPON is meant to collide with everything except players, but if this hook was used, then wouldn’t every prop picked up be set to not collide?

I’d also recommend just using collision groups, just remember to reset it back to normal on PhysgunDrop, or probably after some time when it’s not moving fast enough to kill so you can’t throw it into people.

But for the sake of whether or not your code works, Gmod won’t magically nocollide your entity because a global variable is called something related to collision. And even if it did, you’d probably want to store that variable on the entity, and not globally :slight_smile:
[lua]ent.ShouldCollide = false[/lua]