01 | local clicked = 0 |
02 |
03 | script.Parent.ClickDetector.MouseClick:Connect( function () |
04 | if clicked = = 0 then |
05 | clicked = 1 |
06 | workspace.Move.Position = Vector 3. new(- 32 , 7 , 31.5 ) |
07 | else |
08 | clicked = 0 |
09 | workspace.Move.Position = Vector 3. new(- 32 , 7 , 32.5 ) |
10 | end |
11 | end ) |
when it moves back.. instead of going back it goes on top of the part behind it
You need to use CFrame instead of position.
01 | local clicked = 0 |
02 |
03 | script.Parent.ClickDetector.MouseClick:Connect( function () |
04 | if clicked = = 0 then |
05 | clicked = 1 |
06 | workspace.Move.CFrame = CFrame.new(- 32 , 7 , 31.5 ) |
07 | else |
08 | clicked = 0 |
09 | workspace.Move.CFrame = CFrame.new(- 32 , 7 , 32.5 ) |
10 | end |
11 | end ) |
Bare in mind that unless the brick you're moving is anchored then it'll just pop straight back out again thanks to physics.