I need help in cloning this object!

Hi, I am learning how to script and I got stuck with this code.

local part = game.ReplicatedStorage.Couch

local part2 = part:Clone()

script.Parent.ClickDetector.MouseClick:Connect(function()
	part2:Clone()
	part2.Anchored = false
	part2.Parent = game.Workspace
	part2.Position = Vector3.new(23.217, 64.838, 90.85)
end)

I am wanting it to clone the object which is in ReplicatedStorage, but although I have unanchored it, it just stays in the sky and does not fall to the ground.

As you can see, it does not fall to the ground
image

Thanks for reading! :slightly_smiling_face:

1 Like

If I move it down, then it gets unanchored. Although as soon as it is cloned it does not fall to the ground

1 Like

Move the part variable inside the function

local part = game.ReplicatedStorage.Couch

script.Parent.ClickDetector.MouseClick:Connect(function()
	local part2 = part:Clone()
	
	print("Test")
	part2:Clone()
	part2.Parent = game.Workspace
	part2.Position = Vector3.new(23.217, 64.838, 90.85)
end)
2 Likes

Check if any part of the model inside ReplicatedStorage is anchored.

No, I haven’t anchored it. It is all unanchored, except I have welded a killbrick to the couch. Which is also unanchored.

Is a local script?

Summary

chaaaaaaaaar

image
image

It isnt a local script, it is a normal script.

Try removing the weld for a bit

@TheDestroyer0525 should I use a local script?

You can’t use Anchored on localscripts

But without a weld the killbrick and couch woudn’t be attached right?

What if I use a weld constraint?

Will that work? I haven’t used a local script

You should be using weld constraint regardless… its superior to weld.

I removed all the welds, still does not work

Oh ok, I will try that. Thanks.

I think u have to unanchor every part inside it or the ones that are welded to it

@RMofSBI It does not work even though I just used weld constraint.

I did unanchor all the parts welded to the couch. In fact, I also wrote

part2.Anchored = false