Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 6 years ago

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?

0
Any errors? nilVector 812 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

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!

0
I do have a question, is there any way to shorten the time of how long it is being played (The audio) RealHexYT 12 — 6y
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. nilVector 812 — 6y
0
You can do game:GetService("RunService"):RenderStepped:wait() to wait 1/60th of a second I believe. Operation_Meme 890 — 6y
View all comments (2 more)
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 User#21908 42 — 6y
0
I will keep the things you said in mind for next time User#21908 42 — 6y
Ad

Answer this question