How do I move an object by 1 stud?

Hello everyone, so I have this line of code that moves an object in the workspace for me:

object:SetPrimaryPartCFrame((CFrame.new(mouse.Hit.X, mouse.Hit.Y, mouse.Hit.Z)

And it works fine, but it moves the object with a 0 stud difference. I want it to move for every 1 stud. Does anyone know how to achieve this? Thanks!

Do:

object:SetPrimaryPartCFrame((CFrame.new(math.round(mouse.Hit.X), math.round(mouse.Hit.Y), math.round(mouse.Hit.Z))

It’ll round it to the nearest stud

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.