|
| 02 Apr 2016 11:05 PM |
function splatter() local drop = script.Parent.Parent.Splat:Clone() drop.Parent = game.Workspace drop.Name = "Splatter" drop.Position = script.Parent.Parent.Torso.Position end
roblox keeps giving me the error: Splat is not a valid member of Model WHEN ITS IN THE MODEL. Anyone know whats going on? |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2016 11:07 PM |
Are you sure you meant to put script.Parent.Parent.
script.Parent - Is the model the script is in script.Parent.Parent - Is the model that the scripts parent model is in |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2016 11:34 PM |
Yes
- Model -- Humanoid --- Script -- Splat
WHY DOESNT THIS WORK!? |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2016 11:45 PM |
Check Splat, and make sure "Archivable" is set to true. If this is set to false, the object will be destroyed upon running the game.
|
|
|
| Report Abuse |
|
|
|
| 02 Apr 2016 11:54 PM |
Yep. Archivable is set to true. Still don't get whats going wrong here. :/ |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 12:56 AM |
Interesting. Make sure to check where objects are in explorer, and make sure you are looking for the right items. Otherwise, I dunno what to say.
|
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 03 Apr 2016 01:05 AM |
I don't see anything wrong but I would write it like this
model = script.Parent.Parent
function splatter() local drop = model:FindFirstChild("Splat"):clone() drop.Parent = workspace drop.Name = "Splatter" drop.Position = model.Torso.Position end
-Salinas con el número 23 |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 01:13 AM |
@Salinas23, and I guess in the event you get the same error, you would do:
Model = script.Parent.Parent function Splatter() local Drop = Model:FindFirstChild("Splat"):Clone() if Drop then Drop.Parent = game.Workspace Drop.Name = "Splatter" Drop.Position = Model.Torso.Position elseif Drop == false then return end end Splatter()
|
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 03 Apr 2016 01:27 AM |
Keep in mind that FindFirstChild() returns either the object or nil. Meaning if you apply additional functions at the end of FindFirstChild() and it happens to return nil, it'll error because you can't do nil:clone().
Either you got too many Parents, not enough Parents, the name is wrong, or something is removing it before the function is called. You're not limited to the above issues, however. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 01:32 AM |
Locard your T-Shirt is beautiful.
|
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 02:58 AM |
@firemomo45 Your problem is more than likely that 'Splat' is not existing within the Parent at the time of execution; this is a roblox bug that has been around for a while, where the script'll load before the part/ asset does, and thus an error.
To get around this, use the 'WaitForChild' method of the Parent, as it'll never return nil and yield the code until the asset is within the parent finally.
#LogicBeLogic |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 03:29 AM |
I think its because it gets removed before It can be cloned. Thanks Locard! i realized it now! The splat object is removed from the game Before the game clones it, and because of that the game returns it Nil. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 03:34 AM |
| But now im having the same problem with another object and it returns the same error. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 06:37 AM |
| Thanks for the help guys, the problem got so bad I had to make an entirely new instance with Instance.New(). Finally though this actually worked. |
|
|
| Report Abuse |
|
|
|
| 03 Apr 2016 10:51 AM |
Good. That's always a good way to go.
|
|
|
| Report Abuse |
|
|
Salinas23
|
  |
| Joined: 28 Dec 2008 |
| Total Posts: 37142 |
|
|
| 03 Apr 2016 11:30 AM |
inb4instancereturnsnil
-Salinas con el número 23 |
|
|
| Report Abuse |
|
|