I have a script that is supposed to clone a model, take all of the children of the model and change their parent to another model, based on the presence of certain parts within the clone. Output says,
- The Parent property of ArmorExampleOld is locked, current parent: NULL, new parent Workspace
local player = game.Players.LocalPlayer local char = player.Character local T = game.Lighting.ShopAndInventoryFunction.PropStorage:FindFirstChild ("ArmorExample")
function EquipChestPlate() local A = game.Lighting.ShopAndInventoryFunction.PropStorage.Ibethien.BreastPlates:FindFirstChild(script.Parent.ItemId.Value) local B = T:Clone() local Z = A:Clone() Z.Parent = game.Workspace wait(2) player.PlayerGui.Inventory.InfoLabel.ChestInfo.Text = (script.Parent.ItemId.Value) Z:SetPrimaryPartCFrame(game.Workspace.MorphPlacement.MorphTorsoPositioner.CFrame) local F = game.Workspace.LoadoutDisplay.BTorso.MainPart:Clone() local G = game.Workspace.LoadoutDisplay.BTorso.HeadPart:Clone() F.CFrame = game.Workspace.LoadoutDisplay.BTorso.MainPart.CFrame G.CFrame = game.Workspace.LoadoutDisplay.BTorso.HeadPart.CFrame game.Workspace.LoadoutDisplay.BTorso:ClearAllChildren() F.Parent = game.Workspace.LoadoutDisplay.BTorso G.Parent = game.Workspace.LoadoutDisplay.BTorso for _, child in ipairs(Z:GetChildren()) do if (child ~= nil) then child.Parent = game.Workspace.LoadoutDisplay.BTorso game.Workspace.ArmorExampleOld:Destroy() B.Parent = game.Workspace B.Torso.CFrame = (game.Workspace.MorphPlacement.DeliveryBase.CFrame) wait(0.1) B.Torso.CFrame = (game.Workspace.StageCore.CFrame) B.Name = ("ArmorExampleOld")
else return end end end
script.Parent.MouseButton1Click:connect(function() if script.Parent.ItemType.Value == ("ChestPlate") then EquipChestPlate()
end
end)

2 comments
Fix your code block please!
Yeah, put all your code in a code block format to make it easier to read