Weapon base's PrimaryAttack fucks up in a gamemode, but works fine in Sandbox (MP ISSUE)

Like the thread title says I’m experiencing an issue I can’t find a fix for. The weapon base functions perfectly fine in MP when I’m in Sandbox, but when it’s a custom gamemode I’m currently working on, it’s PrimaryAttack function bugs the fuck out. What happens is that the client calls PrimaryAttack multiple times. I’ve put

[lua] if not IsFirstTimePredicted() then
return
end

print(CLIENT)[/lua]

At the top of the PrimaryAttack function and it only prints it once per click, but the amount of muzzleflashes and other things being called is dependant on the player’s ping that I simulate with net_fakelag. The higher the ping - the more prediction errors occur. It’s as if it doesn’t call SetNextPrimaryFire. Like I already said, the code is exactly the same as the base I used in Sandbox. I’ve also double-checked the gamemode’s code to be sure that I don’t call SetNextPrimaryFire anywhere in the gamemode hooks.

Can someone tell me what the fuck is going on?

I can only say that prediction in GMod is fucked on so many levels…

I wish that Garry would dedicate one update to fixing the prediction issues that are crawling out of everywhere.