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: Egg laying script, I've got some questions.

Previous Thread :: Next Thread 
bludud1234 is not online. bludud1234
Joined: 29 May 2010
Total Posts: 43
18 Mar 2017 10:38 AM
So I just started learning how to script and my code is horrid. Right now I am working on a script that will make its parent "lay eggs" as in dropping a round object with a script in it right below itself. I intend for the "egg" to hatch into whatever it's parent is after a set amount of time.

Egg = Instance.new("Part", Workspace)
Egg.Shape = Enum.PartType.Ball
Egg.Size = Vector3.new(2, 2, 2)
Egg.Material = "Foil"
Egg.BrickColor = BrickColor.White()
Egg.Name = Egg
while true do
Instance.new("Egg", Workspace)
wait(5)
end


I had it working somewhat before so that it would spawn the Egg object somewhere beside it, but then Roblox Studio decided to crash and now the 7th line of code gives an error, right now the only thing this will do is spawn the Egg when the game starts, (Which I did not want to to because it is supposed to spawn the Egg after 5 seconds) but I want it to keep spawning eggs every 5 seconds.

The main thing I am trying to figure out is how to create an object with code, ## well ## code that creates code in the object that it is creating.
Report Abuse
6191X is not online. 6191X
Joined: 21 Jan 2017
Total Posts: 119
18 Mar 2017 10:46 AM
Egg = Instance.new("Part", Workspace)
Egg.Shape = Enum.PartType.Ball
Egg.Size = Vector3.new(2, 2, 2)
Egg.Material = "Foil"
Egg.BrickColor = BrickColor.White()
Egg.Name = Egg
while true do
egg.Parent = workspace
wait(5)
end
Report Abuse
00doggie is not online. 00doggie
Joined: 30 Jul 2009
Total Posts: 337
18 Mar 2017 10:50 AM
perhaps you could have a copy of the script in the ReplicatedStorage and you could just do local clone = ##################################### clone.Parent = Egg just put that stuff in your script (make sure you put the script in replicated storage)
Report Abuse
00doggie is not online. 00doggie
Joined: 30 Jul 2009
Total Posts: 337
18 Mar 2017 10:52 AM
if you dont know what I mean with the tags, I can elaborate, but I think even with tags you get the idea
Report Abuse
CrniOrao is not online. CrniOrao
Joined: 12 Oct 2008
Total Posts: 2274
18 Mar 2017 11:16 AM
function SpawnEgg()
Egg = Instance.new("Part", Workspace)
Egg.Shape = Enum.PartType.Ball
Egg.Size = Vector3.new(2, 2, 2)
Egg.Material = "Foil"
Egg.BrickColor = BrickColor.White()
Egg.Name = "Egg"
end

while true do
wait(5)
SpawnEgg()
end
Report Abuse
bludud1234 is not online. bludud1234
Joined: 29 May 2010
Total Posts: 43
18 Mar 2017 11:24 AM
Thanks! So how do I create the Egg so that it has script in it rather then just a being a plain part?
Report Abuse
Talji is not online. Talji
Joined: 02 Mar 2017
Total Posts: 7
18 Mar 2017 12:33 PM
clone a union cframe it to torso and unachor the union
Report Abuse
bludud1234 is not online. bludud1234
Joined: 29 May 2010
Total Posts: 43
18 Mar 2017 12:44 PM
I'm new to scripting, so I don't really understand much of that, why would it be anchored in the first place?
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