Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do i move the part without going up if it colided to another part?

local clicked = 0

script.Parent.ClickDetector.MouseClick:Connect(function()
	if clicked == 0 then
		clicked = 1
		workspace.Move.Position = Vector3.new(-32, 7, 31.5)
	else
		clicked = 0
		workspace.Move.Position = Vector3.new(-32, 7, 32.5)
	end
end)

when it moves back.. instead of going back it goes on top of the part behind it

1 answer

✓ Accepted answer

You need to use CFrame instead of position.

local clicked = 0

script.Parent.ClickDetector.MouseClick:Connect(function()
    if clicked == 0 then
        clicked = 1
        workspace.Move.CFrame = CFrame.new(-32, 7, 31.5)
    else
        clicked = 0
        workspace.Move.CFrame = CFrame.new(-32, 7, 32.5)
    end
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.

1 comment

0

thanks

This discussion is preserved as it was. New answers, comments, and votes are closed.