I tested and this works. Problem is I dont understand the function “raycastThing you changed”. I wont use script I do not understand.
What does this
if typeof(Part:GetTouchingParts()) == "table" and typeof(workspace:GetPartBoundsInBox(Part.CFrame, Part.Size)) == "table" then
and this
if Player.Character:IsAncestorOf(part) and table.find(workspace:GetPartBoundsInBox(Part.CFrame, Part.Size), part) then
do?