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 » Scripting Helpers
Home Search
 

Re: Clone script problem

Previous Thread :: Next Thread 
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
06 Nov 2013 05:38 PM
I can't seem to figure out why this doesn't work. No output error. It just doesn't clone. Maybe it has something to do with the zombie being a humanoid?
Script:
if game.Workspace:findFirstChild("Zombie", false) then
game.Lighting.Zombie:clone().Parent = game.Workspace
end
Report Abuse
rosie92680 is not online. rosie92680
Joined: 17 Oct 2011
Total Posts: 1511
06 Nov 2013 05:41 PM
Don't there need to be a "==" for the if line?
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
06 Nov 2013 05:41 PM
What you are telling your Script to do is go find an Instance named "Zombie" in Workspace, and if it finds it to clone an Instance from Lighting into Workspace. The reason this probably doesn't work is that you have no model in Workspace named "Zombie".

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Merilo is not online. Merilo
Joined: 01 Aug 2011
Total Posts: 500
06 Nov 2013 05:42 PM
Maybe the zombie is set to archivable???


also make sure it is a loop
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
06 Nov 2013 05:42 PM
@rosie92680
Nope. "==" is just used to turn something into a boolean. For example:

print(type(game.Workspace.Name == "Workspace"))
> boolean

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
06 Nov 2013 05:43 PM
@Nelson
Really? I thought the ", false" part means that if it can't find Zombie.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
06 Nov 2013 05:44 PM
Nope. The second argument determines whether or not the search is recursive. For example, let's say you have a Part in Workspace:

print(game:FindFirstChild("Part", false))
> nil
print(game:FindFirstChild("Part", true))
> Part

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Adam2090 is not online. Adam2090
Joined: 19 Jul 2010
Total Posts: 889
06 Nov 2013 05:47 PM
Okay, so how would I make the script detect if there is a "Zombie" in Workspace?
Report Abuse
Merilo is not online. Merilo
Joined: 01 Aug 2011
Total Posts: 500
06 Nov 2013 05:48 PM
i was about to say that the false was redundant, but didn't want to waste time/maybe you know what you're doing.
Report Abuse
DaMrNelson is not online. DaMrNelson
Joined: 27 Jul 2009
Total Posts: 4405
06 Nov 2013 05:48 PM
if (game.Workspace:FindFirstChild("Zombie")) then
-- There is a Zombie in Workspace
else
-- There is not a Zombie in Workspace
end

Wiki Profile: http://wiki.roblox.com/index.php/User:Nelson
Report Abuse
Merilo is not online. Merilo
Joined: 01 Aug 2011
Total Posts: 500
06 Nov 2013 05:51 PM
while game.Lighting:FindFirstChild("Zombie") do
if workspace:FindFirstChild("Zombie") then
if not game.Lighting.Zombie.Archivable then
game.Lighting.Zombie.Archivable = true
end
game.Lighting.Zombie:Clone().Parent = workspace
end
wait(1)
end
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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