|
| 08 Mar 2015 09:48 AM |
It's supposed to check if Fabulous Zombie is in Workspace and if true then play music.
function FindFirstChild() if game.Workspace["Fabulous Zombie"] == true then local s = Instance.new("Sound") s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=131060210" s.Volume = 1 -- How loud it is s.Pitch = 1 -- How high pitched it is s.Looped = false s.archivable = false
s.Parent = game.Workspace
wait(0)
s:play() wait(3) end end |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 09:53 AM |
You probably can't set the function name to FindFirstChild because it is used by ROBLOX And why did you set archivable to false? |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 09:57 AM |
You've made a function, FindFirstChild, but you don't use it. The code inside it never runs.
You need to use the FindFirstChild method of instances if you aren't sure they will be there.
if game.Workspace:FindFirstChild("Fabulous Zombie") then
You can't check if this is equal to something because you aren't sure it's there. It will certainly never be true. My condition asks if the zombie is not nil and not false. |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 09:59 AM |
Alright, got it.
if game.Workspace:FindFirstChild("Fabulous Zombie") then local s = Instance.new("Sound") s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=131060210" s.Volume = 1 -- How loud it is s.Pitch = 1 -- How high pitched it is s.Looped = false s.archivable = false
s.Parent = game.Workspace
wait(0)
s:play() wait(3) end
|
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 10:01 AM |
| Now that you've removed the function, you need to remove "end" as well. |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 10:15 AM |
| How can I make it so it constantly checks though? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 08 Mar 2015 10:49 AM |
| Look up while true do and return end |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Mar 2015 10:59 AM |
if game.Workspace:FindFirstChild("Fabulous Zombie") ~= nil then --play music end
|
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 11:06 AM |
@GeoVolcano Doesn't work.
The script I have right now works if they're already in the Workspace but if they get added into it from Lighting it won't work. |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Mar 2015 11:13 AM |
So then it'd be this?
if game.Workspace.ChildAdded("Fabulous Zombies")then (sound scripting) |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 08 Mar 2015 11:52 AM |
function FindFirstChild() if game.Workspace["Fabulous Zombie"] ~= nil then local s = Instance.new("Sound",game.Workspace) s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=131060210" s.Volume = 1 -- How loud it is s.Pitch = 1 -- How high pitched it is s.Looped = false s.archivable = false
wait(0)
s:play() wait(3) end end
Try that. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 08 Mar 2015 12:11 PM |
if game.Workspace:findFirstChild("Fabulous Zombie") then local s = Instance.new("Sound") s.SoundId = "http://www.roblox.com/asset/?id=131060210" s.Volume = 1 s.Pitch = 1 s.Looped = false s.Archivable = false s.Parent = game.Workspace s:Play() end
"I like to program." - Bosswalrus |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 12:11 PM |
use thissssssssssssssss
search = game.Workspace:FindFirstChild("Fabulous Zombie") if search ~= nil then local s = Instance.new("Sound",game.Workspace) s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=131060210" s.Volume = 1 -- How loud it is s.Pitch = 1 -- How high pitched it is s.Looped = false s.archivable = false wait(0) s:play() wait(3) end |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 12:30 PM |
| Doesn't work because the model isn't in Workspace to begin. My script I have right now is efficient but it doesn't keep checking until the model is in the Workspace. |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 12:39 PM |
repeat wait(0.1) local search = game.Workspace:FindFirstChild("Fabulous Zombie") until search ~= nil if search ~= nil then local s = Instance.new("Sound",game.Workspace) s.Name = "Sound" s.SoundId = "http://www.roblox.com/asset/?id=131060210" s.Volume = 1 -- How loud it is s.Pitch = 1 -- How high pitched it is s.Looped = false s.archivable = false wait(0) s:play() wait(3) end
???? |
|
|
| Report Abuse |
|
|
|
| 08 Mar 2015 07:19 PM |
while true do if game.Workspace:FindFirstChild("Fabulous Zombie") then local s = Instance.new("Sound", Workspace)-- Change it to put the sound into either a brick or GUI. s.SoundId = "http://www.roblox.com/asset/?id=131060210" s.Volume = 1 s.Pitch = 1 s.Looped = false s.Archivable = false s:Play() end wait(1) end |
|
|
| Report Abuse |
|
|