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: How to scan for NPC in workspace on roblox?

Previous Thread :: Next Thread 
TheCrazyBlocks is not online. TheCrazyBlocks
Joined: 08 Jul 2014
Total Posts: 283
12 Feb 2017 01:57 AM
Want the script to search in Workspace for the NPC and if there is none then to begin another round via while true do loop.
Report Abuse
Prenup is not online. Prenup
Joined: 26 Dec 2015
Total Posts: 1140
12 Feb 2017 01:58 AM
game.Workspace:FindFirstChild("NPCName")?


Report Abuse
TheCrazyBlocks is not online. TheCrazyBlocks
Joined: 08 Jul 2014
Total Posts: 283
12 Feb 2017 02:01 AM
Oh thanks.

but if it doesn't find any it would be like this?

while true do
game.Workspace:FindFirstChild("NPCName") if childnotfound then
StartRound()

end

What would I put if it doesn't find the child?
Report Abuse
Prenup is not online. Prenup
Joined: 26 Dec 2015
Total Posts: 1140
12 Feb 2017 02:03 AM
I'm sure this would work

while true do
if not game.Workspace:FindFirstChild("NPCName") then

StartRound()
end
end


Report Abuse
TheCrazyBlocks is not online. TheCrazyBlocks
Joined: 08 Jul 2014
Total Posts: 283
12 Feb 2017 02:08 AM
Doesn't work
Report Abuse
TheCrazyBlocks is not online. TheCrazyBlocks
Joined: 08 Jul 2014
Total Posts: 283
12 Feb 2017 02:09 AM
while true do
game.Workspace:FindFirstChild("ZombieReg") else
StartRound()

wait(2)
end
end

I believe this might work
Report Abuse
TheCrazyBlocks is not online. TheCrazyBlocks
Joined: 08 Jul 2014
Total Posts: 283
12 Feb 2017 02:12 AM
while true do game.Workspace:FindFirstChild("ZombieReg") wait(1) if "ZombieReg" ## nil then StartRound() This works better
Report Abuse
Prenup is not online. Prenup
Joined: 26 Dec 2015
Total Posts: 1140
12 Feb 2017 02:13 AM
That wouldn't work...

Are you sure its not the StartRound() function thats causing an error?


What does the output say?


Report Abuse
TheCrazyBlocks is not online. TheCrazyBlocks
Joined: 08 Jul 2014
Total Posts: 283
12 Feb 2017 02:15 AM
Output has no errors or anything
Report Abuse
Prenup is not online. Prenup
Joined: 26 Dec 2015
Total Posts: 1140
12 Feb 2017 02:18 AM
If you haven't solved your problem yet could you please post the full script.


Report Abuse
TheCrazyBlocks is not online. TheCrazyBlocks
Joined: 08 Jul 2014
Total Posts: 283
12 Feb 2017 02:20 AM
function StartRound()
--Begin
script.Parent.Parent.Lighting.Zombies:Clone()
end

while true do
game.Workspace:FindFirstChild("ZombieReg")
wait(1)
if "ZombieReg" == nil then
StartRound()
wait(2)
end
end

This is full script
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
12 Feb 2017 02:21 AM
while wait() do if not workspace:FindFirstChid('ZombieReg') then ############### round...') StartRound() else ############ is not over...') wait(2) end end
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
12 Feb 2017 02:22 AM
pastebin
.
com/DZjtRa7m


Report Abuse
TheCrazyBlocks is not online. TheCrazyBlocks
Joined: 08 Jul 2014
Total Posts: 283
12 Feb 2017 02:23 AM
Thanks a lot, ROBLOX is filtering way too much on the forums.
Report Abuse
Prenup is not online. Prenup
Joined: 26 Dec 2015
Total Posts: 1140
12 Feb 2017 02:24 AM
function StartRound()
--Begin
newZombie = game.Lighting.Zombies:Clone()
newZombie.Parent = game.Workspace
end

while true do
if not game.Workspace:FindFirstChild("ZombieReg") then
wait(1)
StartRound()
end
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