Stick-Drag parts like as in Pizza Place?

Tell me how to move objects with the mouse, and with sticking to the grid/other objects. The perfect example I need is moving objects like in Pizza Place.

If you have a piece of code or a video of how this is done - I will be very grateful. because I could not find anything other than the usual drag and drop.

2 Likes

You can use mouse.Hit.Position inside a local script

local userInputService = game:GetService("UserInputService")
local mouse = game.Players.LocalPlayer:GetMouse()

userInputService.InputBegan:Connect(function(input)
	if input.UserInputType == Enum.UserInputType.MouseButton1 then 
		mouse.TargetFilter = part
		repeat
			part.Position = mouse.Hit.Position
		until input.UserInputState == Enum.UserInputState.End
	end

This wont replicate though you’ll have to do that part

how to move an object with the mouse is not a problem. the question is different - how to make the move sticky. so that the object being moved can move in increments not of 1 unit, but of 10 for example. and could stick to the center of other objects if the cursor is next to it.

I specifically listed the Pizza Place experience as an example of what I need.

1 Like

Not sure about that one, sorry about the late reply

If you’re still wondering then heres the answer a year later because some random dude necroposted it. You use math.clamp and multiply the position by an increment number.