Why is :Clone() returning nil for me?

Hello everyone, hope you are having a good day. I am getting this error message:

Players.crossbar.PlayerGui.PlacementEvent.ClientPlacement:288: attempt to index nil with ‘Parent’

Here is my code:

local model = furniture:FindFirstChild(modelNameGiven)
	
print("Furniture model: ", model)
	
local modelClone = model:Clone()
	
modelClone.Parent = workspace -- This is line 288 of the script, nil

This is also in a LocalScript. I don’t know why cloning the model results in nil, when the model itself is found and does not break any lines in the code. As soon as I clone it though the model returns nil and I get an error. I don’t know why. Could anyone tell me? Thank you very much!

Im guessing the script can’t find the model, try using a string or a path with a name, idk.

Does your print statement print?

Model is found. It returns the name of the model in this line:

print("Furniture model: ", model)

But as soon as I try to clone it it just returns nil for me. Was there an update that deprecated the ability to clone parts locally? Thanks.

Well… no, probably would be disastrous.

But im not sure why it’s not working otherwise. Can you provide a little more context of your script, for example what is “modelNameGiven”.

I guess you can also try wrapping it in an if statement and seeing if that works? Really weird though.

if modelClone then
modelClone.Parent = workspace
end

There is a property called Archivable. If archivable is off, then the instance can’t be cloneable. Check to see if model has Archivable set to true.

It might be important to add that the model is also from ReplicatedStorage. Maybe that’s why?

Being in ReplicatedStorage shouldn’t affect anything.

Nope, that shouldn’t be causing the issue. I guess try wrapping it in an if statement if you haven’t tried already, or check if it was Archivable, set it to true if false.

Yes, it seems I have a script that is turning its Archivable setting to false automatically. It will probably work once I find the script that’s doing this. Thanks for all your help everyone.

2 Likes