I want to make a script to play music once you touch a model. I am using this to make a piano. Once you Touch the keys it starts to play a song, but when you stop, it stops. Could anyone help? It would be greatly appreciated of some one else actually made the script itself with a way for me to enter the music ID and that'd be all. Thanks in advance for your help. This isn't a request, I was saying it would be appreciated. I have no coding experience so a step-step guide would be the most help if it's not too much trouble.
COMMUNITY QUESTION
Could someone help make a play on touched script?
1 answer
function onTouched(hit)
game.workspace.song:Play()
script.Parent.Touched:connect(onTouched)
In this script, you touch the brick u put it in and the song will start. Put the song in the workspace and name it song. Disable it to.
Another way:
function onTouched(hit)
local s = Instance.new("Sound", game.Workspace)
s.SoundId = 00000 -- change to ID of song
script.Parent.Touched:connect(onTouched)
This discussion is preserved as it was. New answers, comments, and votes are closed.
