[PWN] How do you guys go about debugging exploits that work locally, but not remotely?

So I’m working on the restaurant challenge right now and after lots of debugging, finally got my exploit to work locally. However, when sending the exploit over to the remote server to grab the flag, my exploit results in a segfault.

How should I go about debugging this? I’ve taken into account all the obvious things like ASLR, different libc versions on local/remote etc. I just feel like I’ve hit a wall and am completely stuck.

This question isn’t just about the restaurant challenge, as I’m sure there are a lot more challenges out there for which exploits might work locally, but need some changes to work remotely.