Can we go: game.Workspace.Lighting.Sword:Clone() sword.Parent = sword.Parent.Starterback
I know we can't just go like that I need some help on it.
Can we go: game.Workspace.Lighting.Sword:Clone() sword.Parent = sword.Parent.Starterback
I know we can't just go like that I need some help on it.
Instance:Clone() returns a reference to the cloned instance, so just use that:
local ClonedInstance = Instance:Clone()
ClonedInstance.Parent = TargetParent
There are two ways you could go about it
The first is doing it all without creating a variable for the object. This would mean you can't make any changes after parenting the object
game.Workspace.Lighting.Sword:Clone() .Parent = sword.Parent.Starterback
The second way is to assign the cloned object to a variable, which would allow you to make changes even after parenting the object
local clone = game.Workspace.Lighting.Sword:Clone()
clone.Parent = sword.Parent.Starterback
clone.Name = "Woah I can still change this!"
As you can see in the second example we were able to change the name of the cloned object after parenting it
Hope this helped!
This discussion is preserved as it was. New answers, comments, and votes are closed.