Hello,

I am trying to script some sound in my simulation game. The idea is that if you touch and hold the H the sound will play. If have tried it with media_play and that did do it quite well, but when I touch the H the model suddenly runs slow. How can I fix this problem?

After that I tried it with snd_play, and I have the following code:

Code:
SOUND toeter = "toeter_PP.wav";

var toetertje;

function horn() {
	while(key_h == 1) {
		toetertje = snd_play(toeter,100,0);
		
		wait(1);
	}
}

on_h = horn();

Is there a solution to solve this problem?

Thanks in advance.