I'm a new DM, but I've been playing DnD for a little while now. As of right now I'm running pre-made campaigns until I get the hang of DMing enough to make my own. Right now we're running Keep on the Shadowfell, and we ran into a small problem with ambushes. I was under the impression that ambushes worked like this; The players are not aware of the creatures until they are with a certain amount of space from them, even if they roll a perception check. But my players started giving me grief about this and said that they should be able to see the attack before it happens if they roll high enough. I wasn't sure what they should roll against if this is true, and unfortunately the books don't say much on ambushes. So i was caught between a rock and a hard place and just had to settle the dispute myself. I like the idea of ambushes in the game and want to use them again, but I don't want to run into the same problem. Does anyone have any help for a novice DM?
First of all, your character don't always go around rolling perception. Unless something sets them off, enemies are using Stealth against the PCs' passive perception, which is 10 + Perception modifier (it's on the third column of the official character sheet).
Secondarily, the kobolds encouners in KotS are famous for having kobolds way out of their intended positions. I recommend you to read part 1 from this collection of hacks to see why and improve the module. Once your players get into the position marked on the map, compare their passive perception with the stealth rolls of your kobolds. If the players spot them, the kobolds don't get a surprise round. If they don't, surprise! And that's as ambushy as you can get in D&D 4e.
Take also a look at the question I linked as related in a comment to your question. BESW has some good highlights on stealth there.
It looks like you're playing 4e. Let's get a few things out of the way.
Stealth (and by extension ambushes), has been errata'd heavily, so that it actually works on both the player and monster sides. Check the PHB errata or the Rules Compendium for the current wording of the stealth rules.
Second, if you want to deal with stealth, you need to understand the content of the posts here.
Ambushes for monsters and PCs alike work the following way:
Once the Ambushers have revealed themselves combat opens with them hidden and they get a single action each before the start of combat (a surprise round).
The mechanics of stealth and perception can be tricky
In general, unless your characters state they are making a perception check (this goes for insight as well) you use their passives on the sheet. If your stealth rolls fail to beat their passives, well either the characters have very acute senses or the monsters just did a bad time at trying to hide and be quiet.
I would highly recommend you look at and read The Hidden Club. Its a very helpful guide that pools together all the rules and errata from 4e regarding stealth and it might clear up any additional questions you may have.