Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Cloning should be simple?

I sort of have to questions that both pertain to each other to post here:

1. Using the Clone() function is supposed to create a clone of the object, and "make the Parent become nil". What does making the parent become "nil" mean? Does it mean the parent is deleted and replaced by the clone?

2. I'm not sure where the default spawn space for this "clone" is supposed to be (above the Parent, at 0, 0, 0, at some random spot, whatever), so I decided to test out the Clone function with a simple script... but it does not work. Why?

script.Parent.Touched:connect(function(part)
	script.Parent:Clone().Position = Vector3.new(54.2, 2.2, 43.6)
end)

3 answers

Try something along the lines of this:

CLONE = script.Parent:Clone()
CLONE.Parent = --whatever parent
CLONE.Position = Vector3.new(54.2, 2.2, 43.6)

2 comments

0

Also, you need the line of code at the bottom to connect when it's touched.

0

Tried that and got the error "startScript re-entrancy has exceeded 3".

The parent of the clone is not deleted. If it doesnt work, the script's parent (assuming it is a part) is not archivable. Check if it is archivable. If it is, you can clone it. If it isn't, you can't.

Question 1: 'Making the parent nil' means simply to place the clone in workspace. Question 2: It Vector3 moves to the position 0,0,0.

Script: Looks a bit off to me. Try this:

script.Parent.Touched:connect(function ()
	Clone = script.Parent:Clone()
	Clone.Position = Vector3.new(54.2, 2.2, 43.6)
end)

Also, why did you put in 'part' as an argument if you never used it? Taking it out may help.

2 comments

0

Replaced my script with yours but no changes. Thanks for answer question 1, but I'm still completely baffled by why the script isn't working.

0

Er, Emite, are you ABSOLUTELY SURE that the cloned object HAS a Position property? Things like models and fires don't.

This discussion is preserved as it was. New answers, comments, and votes are closed.