I am wanting to stop a player from being able to place poles anywhere on a grid, based on where they place their first pole.
So, basically, player has PoleA, which can be placed anywhere on the grid. That’s fine. However, once they place, they are given PoleB. This pole should ONLY be able to move along 45 degrees from PoleA.
Example here shows valid spots PoleB could be (PoleA == Blue, PoleB == Red).
These are positions they should not be allowed to place on. Even tho PoleB is on a correct grid position, it is not on a valid 45 degree incrememnet from PoleA (45, 90, 135, etc.)

Code here has the positioning for PoleA done. The Round function used basically locks the poles to the players grid. And PoleB gets PoleA, but I don’t know the math to lock it on a grid that resolves around 45 degrees
return function(playersPlot, pole, lowerX, upperX, lowerZ, upperZ)
local MouseHit = MouseRaycast(Enum.RaycastFilterType.Blacklist, {playersPlot.Placing})
if not MouseHit then return end
local MouseClampedP = ClampMouse(MouseHit.Position, lowerX, upperX, lowerZ, upperZ)
if pole.Name == "Pole1" then
pole:PivotTo(
CFrame.new(
Round(
MouseClampedP + Vector3.new(0, pole.Size.X / 2, 0),
5,
playersPlot.Base.Position.Y + (pole.Size.X / 2) + 0.05)
) * CFrame.Angles(0, 0, math.rad(90))
)
else -- Pole2 (needs to lock on a 45 degree)
local Pole1 = pole.Parent.Pole1
pole:PivotTo()
end
end