Hi! Quick little request here, I am attempting to make a script that’ll raycast to the floor and basically place a part at that points position-- and whilst it is doing that, the part is ending up halfway into the floor.
I have never used raycasts up until this point, so this is all still very new to me. How would I make it so that the bottom of the part touches the top here and doesn’t get half stuck? I have the code right here.
local startPos = script.Parent.Position
local direction = Vector3.new(0, -1, 0).unit
local magnitude = 500local ray = Ray.new(startPos, direction * magnitude)
local foundPart, endPos = workspace:FindPartOnRay(ray, script.Parent, false, true)if foundPart == nil then
print(“Part isn’t above a floor!”)
else
script.Parent.Position = endPos
end