Attempt to index Boolean with Parent?

I made a clone of something and players are able to remove/restore that part when needed.

However, it keeps popping up with an error saying: “Attempt to index Boolean with Parent”

local part = workspace.Objects.part;
local partClone = workspace.Objects.part:Clone();
partClone.Position = part.Position;

if workspace.Objects.part == nil then
    partClone = true;
    partClone.Parent = workspace.Objects; -- error here
end

You set partClone to true, a boolean, which you can’t index. All you need to do is remove this line:

partClone = true;
2 Likes

@Pokemoncraft5290’s solution should fix your problem, but any reason why your code has semi-colons at the end of each statement? Lua doesn’t require semi-colons …

I also program in C++ for fun, too, haha.

Got an error:

The Parent property of 'part' is locked, current parent: NULL, new parent Objects

What does this mean? I can :Destroy() the part, but when running the code above, it gives me this error.