|
| 28 Aug 2012 06:37 PM |
I am having an issue with a sound script, calling a nil value even though it is not nil. The script is local and it changes the volume of the sound, then parents a local script into each player that plays the sound that had the volume changed. For some reason the local script that is parented into the players says that the sound object is nil. By the way it does not get any output errors in solo, but it does get errors in output in online.
local Camera = Workspace.CurrentCamera local Sound = Fire
script.Parent = Camera
Sound:Play()
game.Debris:AddItem(Sound, 0.2) game.Debris:AddItem(script, 0.3)
|
|
|
| Report Abuse |
|
|
|
| 28 Aug 2012 06:38 PM |
Opps, it should be
local Camera = Workspace.CurrentCamera local Sound = script.Fire
script.Parent = Camera
Sound:Play()
game.Debris:AddItem(Sound, 0.2) game.Debris:AddItem(script, 0.3)
I was trying to debug it so I posted the wrong one. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2012 06:41 PM |
script.Parent = Camera
That's probably your problem. Scripts don't like to work (and usually never do) in the Camera object. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2012 06:43 PM |
| Is there any other way to localize the sound then? |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2012 06:46 PM |
| Put sounds in the PlayerGui. That's how I do it. Works great |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 28 Aug 2012 07:10 PM |
| You can also make messages and hints local by putting them in PlayerGui, as well. |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2012 07:14 PM |
| I am having trouble playing the sound once it is in player gui. I have tried parented it into each players player gui then playing it, and that did not work. I then tried using a local script that parented into their player gui to play the sound, that also did not work, but both of these only were heard by one player. Am I doing something wrong? |
|
|
| Report Abuse |
|
|
| |
|