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

Play Specific Sound Once When Touched?

Hey, I have this super simple script, but it really feels like a hard thing to do. When I touch a brick, it makes a sound, but it keeps playing over and over. Is there a way for it to just play once and then stop? Thanks!

function onTouched(hit)
	script.Parent.Sound:play()
	wait(2)
	script.Parent.Sound:stop()
end

script.Parent.Touched:connect(onTouched)

-LukeGabrieI

1 answer

✓ Accepted answer

You need to make

:play()

capitalized, like this:


:Play()

same with

 :stop()

should be

:Stop()

3 comments

0

Anything else I should fix?

1

Not really, but touched isn't recommended, I would use magnitude.

1

how would you use magnitude?

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