|
| 14 May 2016 10:42 PM |
So i made a trap thing, where when you touch a wire, everything happens, but when i make an audio play, when you step on it, it will keep playing the audio over and over again on top of each other.
How do i stop this? This is my script.
function triggered() script.Parent.Green.Transparency = 1 script.Parent.Red.Transparency = 0 local s = Instance.new("Sound")
s.Name = "BGMusic" s.SoundId = "http://www.roblox.com/asset/?id=188908311" s.Volume = 1 s.Looped = true s.archivable = false
s.Parent = game.Workspace
wait(1)
s:play()
end
script.Parent.String.Touched:connect(triggered)
|
|
|
| Report Abuse |
|
|
| 14 May 2016 10:46 PM |
function triggered() if playing then return end playing=true script.Parent.Green.Transparency = 1 script.Parent.Red.Transparency = 0 local s = Instance.new("Sound")
s.Name = "BGMusic" s.SoundId = "http://www.roblox.com/asset/?id=188908311" s.Volume = 1 s.Looped = true s.archivable = false
s.Parent = game.Workspace
wait(1)
s:play() end
script.Parent.String.Touched:connect(triggered) |
|
|
| Report Abuse |
|
|
| 14 May 2016 11:42 PM |
http://wiki.roblox.com/index.php?title=API:Class/Sound/Looped
You set looped as a true value for the sound... |
|
|
| Report Abuse |
|