|
| 30 Mar 2013 06:54 PM |
my friend gave me this script, which is basically suppose to make the sound of "wind" play when your avatar reaches a certain point on the Y-axis, and it won't work for me.
local sound = Instance.new("Sound",game.Lighting) sound.Name = "Wind" sound.Looped = true sound.SoundId = "http://www.roblox.com/asset/?id=18435238" local cam = workspace.CurrentCamera local char = script.Parent.Parent.Character
while wait() do if (char:findFirstChild("Torso")) then if (char.Torso.Position.Y >= 50) and (char.Torso.Position.Y <= 300) then if not (cam:findFirstChild("Wind")) then sound.Parent = cam sound:Play() end else if (cam:findFirstChild("Wind")) then cam.Wind:remove() end end end end
now I find a sound of wind, and add the ID, and it doesn't work. My friend also told me to put this in a local script, and into the starter pack. |
|
|
| Report Abuse |
|
|
| |
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 07:06 PM |
Hmm, I tried running the script, and it seems like it somehow puts the sound into your camera when you spawn, even tho your Y-pos is less than 50. Then, because your Y-position is less than 50, it'll remove the wind sound from your cam.
And in this case, you just change the sound's parent to the camera, which then is removed from the game. I suggest you clone the sound instead, replace the lines where you set its parent to:
local clone = sound:clone() clone.Parent = cam clone:play()
See if that works better.
|
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 07:10 PM |
| Okay I'm a major newb when it comes to scripting, where do I put those lines? |
|
|
| Report Abuse |
|
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 07:11 PM |
Here's the whole script, changed:
local sound = Instance.new("Sound",game.Lighting) sound.Name = "Wind" sound.Looped = true sound.SoundId = "http://www.roblox.com/asset/?id=18435238" local cam = workspace.CurrentCamera local char = script.Parent.Parent.Character
while wait() do if (char:findFirstChild("Torso")) then if (char.Torso.Position.Y >= 50) and (char.Torso.Position.Y <= 300) then if not (cam:findFirstChild("Wind")) then local clone = sound:clone() clone.Parent = cam clone:Play() end else if (cam:findFirstChild("Wind")) then cam.Wind:remove() end end end end
copy pasta |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 07:20 PM |
here's the thing though
in the script my friend gave me, there were spaces before some lines
I don't think that registered when I pasted it lol hang on
should I add the spaces back into it? or leave them out? would it matter? |
|
|
| Report Abuse |
|
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
| |
|
|
| 30 Mar 2013 07:23 PM |
When I added it with the spaces, it still didn't work
I figured that the part that says - local sound = Instance.new("Sound",game.Lighting) sound.Name = "Wind"
meant that I had to add the sound and have it named "Wind" into the lighting, so that's what I did
idk if that's right or what
|
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 07:25 PM |
okay it's still not working
hmmmmmm |
|
|
| Report Abuse |
|
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 07:26 PM |
| Well that's weird.. are you sure your character's positions is above 50 and below 300? Because I tested the script again and it works fine. |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 07:28 PM |
Whoa really? And yes I am positive.
What exactly have you done to make it work?
|
|
|
| Report Abuse |
|
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 07:30 PM |
| I basically copied the script once again (the changed version), and then I changed it so the script will check if your position is above or equal to 1 instead of 50. Try that. |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 07:32 PM |
Okay but did you make it a local script and put it in starter pack?
cuz that's what my friend told me to do
and the reason why it's 50 is because on the map I'm trying to use it on, above 50 is when you leave water so yeah
|
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 07:33 PM |
| And I just tried that and it still won't work for me |
|
|
| Report Abuse |
|
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 07:36 PM |
Yes I did. I changed it to 1 merely for testing purposes. It works at 1, so why shouldn't it at 50. This is weird.
I tried one more time, it works fine. |
|
|
| Report Abuse |
|
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 07:40 PM |
| you're also sure the script isn't disabled? If you click the script, then check its properties whether it's disabled or not. |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 07:40 PM |
Even when I put it to 1 it doesn't work for me D:
I'm extremely confuzzled, I put the script into a local script, put it into the starter pack, copied and pasted the exact script and it won't work D: |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 07:41 PM |
| Yeah it's unchecked for "disabled" |
|
|
| Report Abuse |
|
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 07:42 PM |
Wait, you put a script into a local script?
Here's what you do, put the code into a single local script, then put that local script into starterpack. |
|
|
| Report Abuse |
|
|
| |
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 07:52 PM |
| did you test the script in online mode or solo mode? |
|
|
| Report Abuse |
|
|
| |
|
Blob34
|
  |
| Joined: 25 Oct 2007 |
| Total Posts: 128 |
|
|
| 30 Mar 2013 08:19 PM |
Check if this code works
local sound = Instance.new("Sound") sound.Name = "Wind" sound.Looped = true sound.SoundId = "http://www.roblox.com/asset/?id=18435238" local cam = workspace.CurrentCamera local char = script.Parent.Parent.Character
while wait() do if (char:findFirstChild("Torso")) then if (char.Torso.Position.Y >= 50) and (char.Torso.Position.Y <= 300) then if not (cam:findFirstChild("Wind")) then local clone = sound:clone() clone.Parent = cam clone:Play() end else if (cam:findFirstChild("Wind")) then cam.Wind:remove() end end end end |
|
|
| Report Abuse |
|
|
|
| 30 Mar 2013 08:21 PM |
| okay, when I'm done in my game I'll go see if that one works |
|
|
| Report Abuse |
|
|
| |
|