i don't really know how to word this. I'm making a grid placing system, where a part follows your mouse, when you click, it stops following your mouse. it want it to move on a grid of 5, but have no idea how to do it. the closest i've gotten is math.floor, but that only rounds to the nearest whole number, making it a grid of 1. (not filtering enabled, just testing) localscript inside of screengui:
local button = script.Parent.TextButton
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local click = false
button.MouseButton1Click:Connect(function()
if click == false
then click = true
end
local floor = Instance.new("Part", workspace)
floor.Size = Vector3.new(5,.1,5)
floor.Anchored = true
mouse.Button1Down:Connect(function()
if click == true then
click = false
end
end)
repeat
local posx, posy, posz = mouse.Hit.X , mouse.Hit.Y, mouse.Hit.Z
floor.Position = Vector3.new(math.floor(posx),0,math.floor(posz))
wait()
until click == false
end)

2 comments
so.. how would i implement this into math.floor?
You cant. Math.floor floors a number. It doesn't round it. It just cuts off the decimal place from a number.