|
| 19 Mar 2017 12:24 PM |
I was wondering how to make a part the has been created by script have script within it, I'll post the part that I want script in below.
function SpawnEgg() Egg = Instance.new("Part", Workspace) Egg.Shape = Enum.PartType.Ball Egg.Size = Vector3.new(1, 1, 1) Egg.Material = "Foil" Egg.BrickColor = BrickColor.White() Egg.Name = "Egg" end
while true do wait(5) SpawnEgg() end |
|
|
| Report Abuse |
|
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
|
| 19 Mar 2017 12:29 PM |
You would just Instance a script in then parent it to the egg, something like:
local eScript = Instance.new("Script", Egg) |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2017 12:37 PM |
No, because then you couldn't have any content in the script.
local ds = DesiredScript:Clone() ds.Parent = Egg ds.Enabled = true
where DesiredScript, is of course, the desired script. |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2017 12:37 PM |
I'm sorry, I forgot to mention that I am extremely new to scripting, so I do not understand what an eScript is, and I do not fully understand the concept of local. Could you or someone else explain it to me like I am someone with a mental deficiency? |
|
|
| Report Abuse |
|
|
|
| 19 Mar 2017 12:39 PM |
Local just means it will go out of scope once the function exits.
if you had:
function x() local e = true end
The variable e would not exist after x() finishes, so no more memory is taken up. and eScript is just a plain old variable. |
|
|
| Report Abuse |
|
|
LaeMVP
|
  |
| Joined: 24 Jun 2013 |
| Total Posts: 4416 |
|
|
| 19 Mar 2017 12:40 PM |
| You can put a script into the part, but it will be useless. |
|
|
| Report Abuse |
|
|