How to make my Grid Placement System work for mobile?

I want to make my grid system work for mobile

I cannot figure out how to get the position of the tap and/or click with Raycasting.

I have tried DevForum and DevHub

I am using this in a LocalScript but when I try to get the position of the input I cannot figure out how to get it THEN put it in a Raycast to get the position of the tap/click. I am using UnitRay to set the position of the Block to the position of where it collides (Hard to explain but it’s just Raycasting origins)

--Where I need to get the position of the tap and click and use Raycasting
while isBuilding do    
    local unitRay = mouse.UnitRay    
    local ray = Ray.new(unitRay.Origin, unitRay.Direction * 100000)    
    local _,pos = workspace:FindPartOnRayWithIgnoreList(ray,{char;currentBlock;})
					
    currentBlockCFrame = CFrame.new(math.floor(pos.X / gridSize) * gridSize, pos.Y + currentBlock.PrimaryPart.Size.Y/2,math.floor(pos.Z / gridSize) * gridSize)
    mainCFrame = currentBlock.PrimaryPart.CFrame:Lerp(currentBlockCFrame, 1/1.5)
    currentBlock:SetPrimaryPartCFrame(mainCFrame)
    runService.RenderStepped:Wait()
end

--This is where I get the position of the input
uis.InputBegan:Connect(function(input, gpe)
	if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
		inputPos = input.Position
	end
end)