Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I place a copied brick?

Asked by 9 years ago

i have been trying to make so when a part touches another part, it will run a if statement if the parts name is correct, and clone the part with the right name. But I don't know how to place the copied part, i have tried

Part:clone().CFrame = CFrame.new(111.2, 16.1, 86.9)

and

Part:clone().CFrame = Vector3.new(111.2, 16.1, 86.9)

but the part always gets placed on the exact same place as the part it gets copied from, anyone know how to fix?

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
9 years ago

Your problem

You're using a Vector3 datatype to set the CFrame property. The CFrame property takes a CFrame datatype!

Remember to parent the cloned part as well.


How to Fix

The best way to solve your problem would be assigning a variable to the cloned part, then you can edit it properties from the variable.

Set the CFrame property to a CFrame value

Parent the cloned part


Code

local p = Part:Clone()

p.CFrame = CFrame.new(111.2,16.1,86.9)
p.Parent = workspace
Ad

Answer this question