I'm having a problem where I repeatedly get the error "Unable to cast Vector3 to float" Whenever I run this script.
function TouchEnded(touch, gameProcessedEvent)
RayPosition = touch.Position
print("Touch ended at "..tostring(touch.Position))
end
game:GetService("RunService").RenderStepped:Connect(function(dt)
local Camera = workspace.CurrentCamera
local rayDistance = 300
local viewportPoint = Camera.ViewportSize / 2
print(RayPosition)
local unitRay = Camera:ViewportPointToRay(RayPosition, 0)
local usableRay = Ray.new(unitRay.Origin, unitRay.Direction * rayDistance)
part, hitPosition = workspace:FindPartOnRay(usableRay, char)
if part then
print("Hit part: " .. part:GetFullName())
end
end)
The error appears on line 11. Any help will be appreciated

3 comments
the error is saying you can't enter a vector3 value to a float (I think)
That's as much as I know. I can't figure out how to fix it
That's why I didn't post an answer