Let's say I have an X monster, that X when teleports in a random radius relative to the character's torso, now it's not a issue because you're in a clear area that doesn't contain any walls that can block X, but when you're in a closed area, things get messed up, X teleports behind the walls and noclips, I've been told to use raycasting but have no idea how to achieve it.
Here's what I used to handle the positioning of X
X.CFrame = Torso.CFrame * CFrame.new((math.random() * 2-1) * 15, 0, (math.random() * 2-1) * 15)

3 comments
Bump
Whoever said the raycasting, he's right. I don't think there is any other way around it. Research is required indeed, but it will be very useful for you. Roblox Wiki has clear examples of such things. I suggest looking it up.
Well thank you but that didn't point me out into the correct direction really.. still need help