IciFlame
|
  |
| Joined: 28 Sep 2013 |
| Total Posts: 300 |
|
|
| 26 Jan 2016 06:41 PM |
I want to make this part that when you touch it, it plays a sound. I already got that down.
But what do I need to add to make it play only ONCE?
Here's the script: brick=script.Parent other=brick.Parent.play music=brick.Parent.music
function onHit(hit) music:Play() end
script.Parent.Touched:connect(onHit)
I just would like to be told on what to add to make it play the sound once and never again. |
|
|
| Report Abuse |
|
|
FrostOver
|
  |
| Joined: 20 Jun 2013 |
| Total Posts: 299 |
|
|
| 26 Jan 2016 06:42 PM |
local played = false function onHit(hit) played = true music:Play() end |
|
|
| Report Abuse |
|
|
FrostOver
|
  |
| Joined: 20 Jun 2013 |
| Total Posts: 299 |
|
|
| 26 Jan 2016 06:43 PM |
sorry local played = false function onHit(hit) if not played then played = true music:Play() end end |
|
|
| Report Abuse |
|
|
|
| 26 Jan 2016 06:44 PM |
^^^^^
#code print "Hello World!' |
|
|
| Report Abuse |
|
|