Hey, I'm making an egg hunt and i'm trying to give the egg a separate model so the egg radar can track it, but when the egg spawns, they all spawn in this one model. How do I make separate models for the egg to spawn in separately? Thanks.
01 | while true do |
02 |
03 |
04 | if script.Parent.Health = = 0 then |
05 | local model = Instance.new( "Model" ) |
06 | model.Parent = game.workspace:WaitForChild( "Eggs" ) |
07 |
08 | s = game.Lighting.Eggs.EgglessShadow.Object.ChocolateEgg:Clone() |
09 | s.Parent = game.workspace:WaitForChild( "Eggs" ).Model |
10 | s.CFrame = script.Parent.Parent.UpperTorso.CFrame |
11 |
12 | script:Remove() |
13 | end |
14 | wait() |
15 | end |
Change line 9 to be s.Parent = model
. Since all the models have the same name, performing ".Model" on line 9 just gets the first one.
Other notes:
WaitForChild
more than once for a single childworkspace
or game.Workspace
(game.workspace is deprecated)UpperTorso
unless you force all players to use the new character models. The old models have a Torso
, but no UpperTorso
. Both have a HumanoidRootPart
, which I believe is in the same position as the torso.