The block wont move along the negative of the X axis, but works fine with every other axis.
Grid system code:
local grid = .5
function Snap(Position, blockSize)
local posX = math.round((blockSize.X / 2) + Position.X)
local posY = math.round((blockSize.Y / 2) + Position.Y)
local posZ = math.round((blockSize.Z / 2) + Position.Z)
return Vector3.new(posX, posY, posZ)
end
uis.InputBegan:Connect(function(input)
if buildingEnabled.Value == true then
if input.UserInputType == Enum.UserInputType.MouseButton1 then
--local pos = mouse.Hit.Position
local block = game.ReplicatedStorage.Blocks:WaitForChild(script.CurrentBlock.Value)
local pos = Snap(mouse.hit.Position, block.Size)
if block ~= nil then
local a = script.TemplateBlock.Value
local re = block:Clone()
re.Parent = game.Workspace
re.Position = pos
re.Orientation = a.Orientation
end
end
end
end)
** You are now Level 3! **