Client returns true while server returns false (ShouldCollide)

One of the most annoying bugs in my gamemode is that you sort of glitch through the jail when you are supposed to run straight through it. I messed a bit around with my GM:ShouldCollide function, and during some debugging testing, I noticed that the client returns true, while the server returns false. This causes the client to think that you can’t move through it, but the server moves your player entity through it, causing slight lag/rubberbanding, which gets worse with higher ping. You see my function here:


function GM:ShouldCollide( ent1, ent2 )
	if IsValid( jail ) and ent1:GetName() == "jailring" and ent2:IsPlayer() and ent2:Team() != 3 then print("false") return false end
	if IsValid( jail ) and ent2:GetName() == "jailring" and ent1:IsPlayer() and ent1:Team() != 3 then print("false") return false end
	print("true") return true
end 

It is run in shared.lua, together with the round restart function that assigns teams, so the client should know wether you are on team 3 or not. Does anyone know how I can make the client function the same way as the server? The end goal would be that any player in team 3 will collide with it, while any player not in team 3 will walk straight through.

Screenshot of the debugging part:

It keeps going like that as long as I am standing in or right next to jail.

GetName is not synched with client afaik.

The name might be different on the client.

Wow, that was much simpler than I expected. I did notice that the spawning of this entity was in an ‘if SERVER then’ in the weapons SecondaryAttack function. I changed the GetName() into GetModel() and removed the IsValid, and now it works. I feel like an idiot :stuck_out_tongue:
But then again, my first real project, mistakes will be made xD