a = script.Parent -- Shows that anywhere in the script showing "a" is about the part. function OnClicked() -- If an "OnClicked" function is triggered it runs the script. print(a.Name) -- Shows the name of the part in the output. local b = a:clone() -- Clones part. b.Parent = game.Workspace -- Places part in workspace. b.Position.X +6 -- Error end -- Ends the function a.ClickDetector.MouseClick:connect(OnClicked) -- Triggers an "OnClicked" function when a is Clicked.
You don't add a number to the position, you need to add a whole other Vector3 value since Position is a vector3 value. Also, use a "=" to set a property. One equal sign means setting a property, Two equal signs are for if statements
.
a = script.Parent -- Shows that anywhere in the script showing "a" is about the part. function OnClicked() print(a.Name) local b = a:clone() b.Parent = game.Workspace b.Position = b.Position + Vector3.new(6) --Vector3.new(6) is the same as Vector3.new(6,0,0); Just taking shortcuts! end a.ClickDetector.MouseClick:connect(OnClicked)
Hope it helps!
Position
is a Vector3
value so you must use Vector3 when doing it. Although the way you are doing it is by accessing the X axis of the parts position and changing it, so to do that you must do:
b.Position.X = b.Position.X + 6
and for Vector3 it would be
b.Position = b.Position + Vector3.new(6,0,0)