drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
|
| 08 Mar 2014 01:55 AM |
| What would be the most efficient script for playing sounds in bricks once the bricks are in workspace. (For example: if Brick is in workspace then = Play sound, if Brick is in lighting then = sound False) This is kind of the script I need. Please forgive me, because I am not a good scripter :p |
|
|
| Report Abuse |
|
|
iValianT
|
  |
| Joined: 21 Aug 2010 |
| Total Posts: 58381 |
|
|
| 08 Mar 2014 01:57 AM |
ok so
p = script.Parent
if p.Parent == Workspace then p.sound:Play else p.sound:Stop() end |
|
|
| Report Abuse |
|
|
drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
|
| 08 Mar 2014 02:33 AM |
| Studio is reading a script error in that on the line that says: else |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 08 Mar 2014 02:39 AM |
try dis yo
part = script.Parent soundID = 123456 Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..soundID) if part.Parent == game:GetService("Workspace") then audio = Instance.new("Sound", game.Workspace) audio.SoundId = soundID audio.Volume = 1 wait(0.2) audio:Play() elseif part.Parent == game:GetService("Lighting") then audio:Stop() wait(0.1) audio:Destroy() end |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 08 Mar 2014 02:45 AM |
| You guys don't understand, it won't stop when it is in Lighting because the script would have stopped (scripts don't run in Lighting) |
|
|
| Report Abuse |
|
|
noah
|
  |
| Joined: 11 Sep 2006 |
| Total Posts: 18977 |
|
|
| 08 Mar 2014 03:08 AM |
skripts dont run in lighting? hmm i did nawt kno dat
part = game:GetService("Workspace"):FindFirstChild("Part") soundID = 123456 Game:GetService("ContentProvider"):Preload("http://www.roblox.com/asset/?id="..soundID) if part.Parent == game:GetService("Workspace") then audio = Instance.new("Sound", game.Workspace) audio.SoundId = soundID audio.Volume = 1 wait(0.2) audio:Play() elseif part.Parent == game:GetService("Lighting") then audio:Stop() wait(0.1) audio:Destroy() end
problem solvd |
|
|
| Report Abuse |
|
|
drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
|
| 08 Mar 2014 04:44 PM |
| If the brick was inside of a model would I add an extra Parent. to the script? |
|
|
| Report Abuse |
|
|
iValianT
|
  |
| Joined: 21 Aug 2010 |
| Total Posts: 58381 |
|
| |
|
drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
|
| 08 Mar 2014 05:13 PM |
| Hmmm I did, but nothing happened once the model and brick entered workspace... |
|
|
| Report Abuse |
|
|
drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
| |
|
drco12
|
  |
| Joined: 26 Sep 2009 |
| Total Posts: 234 |
|
| |
|