How do I make parts drop in a grid system?

How do I make parts drop in a grid system. My example : Sand in Minecraft

I’ve tried

local tw = game:GetService("TweenService")
local ti = TweenInfo.new(0.5, Enum.EasingStyle.Bounce, Enum.EasingDirection.Out, 0, false, 0)
while true do
	wait(1)
	local ray = workspace:Raycast(script.Parent.Position ,Vector3.new(0, -1000, 0))
	if ray.Instance then
		local Hit = ray.Instance
		local TWW = tw:Create(script.Parent, ti, {Position = Vector3.new(script.Parent.Position.X, Hit.Position.Y + Hit.Size.Y*0.5, script.Parent.Position.Z)})
		TWW:Play()
	end
end

But it seems to glitch.

Would love some help - BMWLuxs

This is very easy, just raycast and round the position to size of the block

Pick a position that you expect to be inside a specific grid square. Divide the vector by the grid size, round each component, then multiply by that same grid size. The resulting values will be multiples of the grid size.

1 Like

Always a great help, thank you so much.