Ah, perhapse the PlayerSpawnObject hook doesn't have a return value. (There is no documentation for it, I just know it gets called on anything they spawn).
The for loop should still work, and CanTool can point to the same function as the PlayerSpawn* hooks since all you need is the ply argument whic is first on both.
if not SERVER then return end
local groups = { "superadmin", "admin", "opperator" } --Add your groups here
local function block_build( ply )
for _,v in groups do
if ply:IsUserGroup( v ) then
return
end
end
ULib.tsay( ply, "You are not allowed to build." )
return false
end
hook.Add( "PlayerSpawnProp", "block_prop", block_build )
hook.Add( "PlayerSpawnEffect", "block_effect", block_build )
hook.Add( "PlayerSpawnVehicle", "block_vehicle", block_build )
hook.Add( "PlayerSpawnSENT", "block_sent", block_build )
hook.Add( "CanTool", "block_tool", block_build )
Try that (slightly more efficient).