generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Why wont this work?

Previous Thread :: Next Thread 
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
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
protectiveEBob is not online. protectiveEBob
Joined: 09 Jul 2012
Total Posts: 1297
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
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
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
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
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
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
08 Mar 2015 10:01 AM
Now that you've removed the function, you need to remove "end" as well.
Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 10:15 AM
How can I make it so it constantly checks though?
Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 10:27 AM
bump
Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 10:47 AM
bump
Report Abuse
18lpickett is not online. 18lpickett
Joined: 15 Jul 2012
Total Posts: 3121
08 Mar 2015 10:49 AM
Look up while true do and return end
Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 10:55 AM
bump
Report Abuse
GeoVolcano is not online. GeoVolcano
Joined: 05 Jul 2012
Total Posts: 1433
08 Mar 2015 10:59 AM
if game.Workspace:FindFirstChild("Fabulous Zombie") ~= nil then
--play music
end


Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
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
GeoVolcano is not online. GeoVolcano
Joined: 05 Jul 2012
Total Posts: 1433
08 Mar 2015 11:07 AM
Workspace.ChildAdded
Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 11:13 AM
So then it'd be this?

if game.Workspace.ChildAdded("Fabulous Zombies")then
(sound scripting)
Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 11:23 AM
bump
Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 11:30 AM
bump
Report Abuse
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 11:41 AM
bump
Report Abuse
SlingJongUnkie is not online. SlingJongUnkie
Joined: 06 Mar 2015
Total Posts: 84
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
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
08 Mar 2015 11:59 AM
Doesn't work.
Report Abuse
SlingJongUnkie is not online. SlingJongUnkie
Joined: 06 Mar 2015
Total Posts: 84
08 Mar 2015 12:07 PM
Why is there a function?
Report Abuse
bosswalrus is not online. bosswalrus
Joined: 04 Jan 2013
Total Posts: 5430
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
SlingJongUnkie is not online. SlingJongUnkie
Joined: 06 Mar 2015
Total Posts: 84
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
thisnameiscreative is not online. thisnameiscreative
Joined: 18 Feb 2015
Total Posts: 541
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
SlingJongUnkie is not online. SlingJongUnkie
Joined: 06 Mar 2015
Total Posts: 84
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
protectiveEBob is not online. protectiveEBob
Joined: 09 Jul 2012
Total Posts: 1297
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image