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: Part is not a valid member of model

Previous Thread :: Next Thread 
firemomo45 is not online. firemomo45
Joined: 02 Oct 2010
Total Posts: 381
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
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
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
firemomo45 is not online. firemomo45
Joined: 02 Oct 2010
Total Posts: 381
02 Apr 2016 11:34 PM
Yes

- Model
-- Humanoid
--- Script
-- Splat

WHY DOESNT THIS WORK!?
Report Abuse
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
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
firemomo45 is not online. firemomo45
Joined: 02 Oct 2010
Total Posts: 381
02 Apr 2016 11:54 PM
Yep. Archivable is set to true. Still don't get whats going wrong here.
:/
Report Abuse
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
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 is not online. 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
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
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 is not online. 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
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
03 Apr 2016 01:32 AM
Locard your T-Shirt is beautiful.


Report Abuse
TheeDeathCaster is not online. TheeDeathCaster
Joined: 19 Jun 2011
Total Posts: 1191
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
firemomo45 is not online. firemomo45
Joined: 02 Oct 2010
Total Posts: 381
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
firemomo45 is not online. firemomo45
Joined: 02 Oct 2010
Total Posts: 381
03 Apr 2016 03:34 AM
But now im having the same problem with another object and it returns the same error.
Report Abuse
firemomo45 is not online. firemomo45
Joined: 02 Oct 2010
Total Posts: 381
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
KomikLegend is not online. KomikLegend
Joined: 25 Jun 2015
Total Posts: 451
03 Apr 2016 10:51 AM
Good. That's always a good way to go.


Report Abuse
Salinas23 is not online. Salinas23
Joined: 28 Dec 2008
Total Posts: 37142
03 Apr 2016 11:30 AM
inb4instancereturnsnil


-Salinas con el número 23
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