Raycast to find a point somewhere on the wall of a room

(Flashbang white paint image in this post so be careful)

Hello!

Currently I’m trying to get a Raycast on the wall of a room model (As stated in the title) for a lightning module.

Basically just trying to make it look like lightning is jumping from a neon sphere in the middle of the room to a wall somewhere else.

TLDR:
Raycasting in a completely random direction and if that Raycast hits a wall, grab the position of where it hits and give that to the script.

(Lightning model already completed by myself, just looking for the solution to the Raycasting thing.)

Having a little trouble cause I cant seem to get this to work.

Diagram image:
Point A would be the origin, B would be where the Raycast hit a wall, NOT a set point.

Blue box = walls,
black line = theoretical raycast,
X = origin/hit pos
blue zigzag = lightning from my module

Any help appreciated.

Best, Xarciti

Have you looked at WorldRoot | Documentation - Roblox Creator Hub yet? This example should suffice to show you how to do what you’re looking to do.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.