Clones are not being parented to the model specified

hello, when I use :Clone() in my script and put the method into a variable, the meshpart does not get parented to the model that I specified.

print("Setup started!")
	for idx, child in pairs(lights.Brake:GetChildren()) do
		if child.Name == "L" then
			local clone = child:Clone()
			clone.Parent = lights.Brake
			clone.Name = "LN"
			if clone:IsA("MeshPart") then
				clone.TextureID = "rbxassetid://0"
			end
			clone.Material = Enum.Material.Neon
			clone.Color = child.Color
			clone.Transparency = 1
			
			local spot = Instance.new("SpotLight", child)
			spot.Name = "L"
			spot.Brightness = 0
			spot.Range = 0
			spot.Face = Enum.NormalId.Back
			spot.Color = Color3.fromRGB(255, 0, 0)
		end	 
	end

image

as you see in the image, the “LN” is not visible when it should be.

1 Like

Where does the “LN” actually get parented to, or does it just not exist?

Also,

local spot = Instance.new(“SpotLight”, child)

The parent argument for Instance.new() takes longer and is slower than just having a new line and setting the parent there.

1 Like

I searched through the workspace only to find that “LN” gets parented no where, it isnt found anywhere in the game. So apparently the clone doesn’t exist.

thanks for the tip with Instance.new()!

Try to add a print(“This passed”) after checking to see if the name of child is “L”. It might not be working right, and therefor not creating any clone.

Is the clone a part? If so is this one Unanchored and CanCollide = false? Tell me.

yes, this clone is a meshpart, but it is anchored and cancollide is false.

it does print the parent and name as if it was there but it does not appear in workspace.

seems like the part was falling out of the world because when it cloned, it became unanchored. fixed now!

1 Like