Addon not working

in addons/MyScripts/lua/autorun/server:

[lua]
function AntiSurf(ply, ent)
ply = player
ent = ply:GetViewEnt()
BaseNoclip = ent:GetCollisionGroup()
BaseMat = ent:GetMaterial()
r1,g1,b1,a1 = ent:GetColor()
if ent:IsValid() then

	ent:SetCollisionGroup(COLLISION_GROUP_WORLD)
	ent:SetMaterial("/models/debug/debug_white")
	ent:SetColor(255,255,0,100) 
	  function BadBarney( hitEnt )
	  	if hitEnt == ply then 
	  		ply:PrintMessage( HUD_PRINTCENTER, "Anti Prop-Surf Enabled.")
	  	 elseif hitEnt:IsPlayer() then
	  	 	ply:PrintMessage( HUD_PRINTCENTER, "Anti Prop-Push Enabled" )
	  	 end
	  end
	  hook.Add("Touch", "AntiPropS/P", BadBarney)
   else
   	hook.Remove("Touch", "AntiPropS/P")
   	ent:SetCollisionGroup(BaseNoclip)
   	ent:SetMaterial(BaseMat)
   	ent:SetColor(r1, g1, b1, a1)
 end

end
hook.Add(“PhysgunPickup”, “RAWR”, AntiSurf)
[/lua]

Don’t be bothered by my unuseful names.

Hello!

Welcome to the Lua Questions section. How may we help you today?

There’s no gamemode hook called Touch? It’s an entity hook, so I didn’t think you could use it with hook.Add?

Thank you, drake, for at least trying to help me. Unlike some troll that can’t be bothered to read the title.

He has a sort of point, you could’ve been more descriptive with how it wasn’t working exactly.

I am not gonna bother fixing / helping you fix your add-on if you won’t even tell us what is wrong.

What are you trying to achieve (you should assume that some people do not know what you are trying to do)? What is happening instead? Are there errors?

Seriously, do you also drive your car into the shop and yell: “Hi, this is broken. Help! Don’t be bothered by my yellow seat belts.”

Nothing is happening, and no errors are given. d:

It should be changing the props color on pickup and not letting it collide with players.

Try something like this:

[lua]
hook.Add(“PhysgunPickup”, “PickupProp”, function(ply, ent)
if (ent:IsValid() and ent:GetClass() == “prop_physics”) then
ent.LastCollisionGroup = ent:GetCollisionGroup()
ent.LastColor = ent:GetColor()
ent:SetCollisionGroup(COLLISION_GROUP_WEAPON)
ent:SetColor(Color(255, 0, 0))
ent.PickedUp = true
end
end)

hook.Add(“PhysgunDrop”, “DropProp”, function(ply, ent)
if (ent:IsValid() and ent.PickedUp) then
ent:SetColor(ent.LastColor or Color(255, 255, 255))
ent:SetCollisionGroup(ent.LastCollisionGroup or COLLISION_GROUP_NONE)
ent.PickedUp = nil
ent.LastCollisionGroup = nil
ent.LastColor = nil
end
end)
[/lua]

This is untested.