Raycast Wont Work

Flip the part upside down then

When I test your code with the edit I made it works perfectly fine. It would be helpful to know what you are using this code for and if what I mentioned below doesn’t fix your issue have a repro file which reproduces the issues you are facing. This is how I am testing your code:

Raycast Fix.rbxl (21.5 KB)

As you are using part.CFrame.UpVector the ray wont go directly up from the part but instead go the direction of the UpVector. It could be possible that the part is upside down. Try flipping the part over or if the parts orientation doesn’t matter change the 10th line to this so the ray always goes directly up:

local raycastResult = game.Workspace:Raycast(part.Position, Vector3.new(0, 1, 0) * 50, raycastParams)
1 Like

Nope, I flipped the part in all directions and nothing happened. No errors, no prints…

It’s moments like these that feel so frusstrating about scripting because you could’ve done everything right and then u suspect that it’s the language code that’s bugged and not urs.

1 Like

Yeah, I couldn’t figure it out for 4 days, which is delaying my learning process. I tried to avoid as much as I can.

It worked! Thanks soo much! :smiley: