For cloning, there are no parameters. So there is no script.Parent:Clone(game.Workspace). Also, if you leave only one number(in this case it's the part's X axis - 10), only the X axis will be set and the rest of the values like y and z will be 0 on default.
#Clone
To set the parent of a cloned part, just set the parent like how you usually do:
f = script.Parent:Clone()
f.Parent = workspace
script.Parent:Clone().Parent = workspace
#Positions
Use CFrame instead incase there is a part in the way. Use Vector3.new or CFrame.new. You just can't have random numbers everywhere.
f.Position = Vector3.new(r - 10)
If you want to change the other values add the Y and Z values
f.Position = Vector3.new(r - 10, 0, 50)
If you want to change it RELATIVE to the original part's position:
f.Position = (f.Position.X,f.Position.Y+10,f.Position.Z )
#Final Product
while wait(1) do
local p = script.Parent:Clone()
p.Parent = workspace
local pos = p.Position
p.CFrame = CFrame.new(p.X-10,p.Y,p.Z)
end
Hope it helps!
1 comment
All 4 answers have different information, please look at all the answers so you understand your mistake and won't make the same one next time!