Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

(?) When stepping on the block it is not making any noise

Sorry for the odd title, wanted a more "Specific title" lol


So Here's the script

function onTouched(hit)
	wait(0)
	script.Parent.Sound:play() 
end
script.Parent.Touched:connect(onTouched)

When touching the block, it should make the Sound (In the block) make noise.

Here's the music/noise Id

1307335902

Any Ideas?

1 comment

0

Any errors?

1 answer

You cannot wait 0 seconds. You could do wait() which is the smallest amount of time possible or you can wait(.1) but you cannot wait for no seconds. Also :connect is deprecated. You should use :Connect. hope this helps. Comment if you need further help. Have a great day scripting!

6 comments

0

I do have a question, is there any way to shorten the time of how long it is being played (The audio)

0

Although you cannot wait 0 seconds, that will not cause any problems, because Roblox will automatically change anything under 1/30 seconds specified in the wait() to be 1/30 seconds. Also, even though :connect is deprecated, it should not cause any problems with any functionality.

0

You can do game:GetService("RunService"):RenderStepped:wait() to wait 1/60th of a second I believe.

0

thx guys for your helpful comments. I did not however think connect was the problem I just wanted to encourage not using deprecated code

0

I will keep the things you said in mind for next time

This discussion is preserved as it was. New answers, comments, and votes are closed.