Spawning a model at a random point along a singular brick?

Spawning models, using MoveTo or basic CFrames/whatever else I’m all good with.
However I don’t know so much about the math side of lua.
Here’s a picture explaining the resource spawning system I’m creating.

I want to spawn rocks along these walls, with the transparent blocks being spawn locations the rock can spawn at a random point along. I know in theory I could just write a whole bunch of if statements for each possible 45 degree angle and use what feels like an unnecessary amount of math to calculate where my rock spawns if the brick it can spawn along is not at a 90 degree angle.

But I was wondering if there’s an easier way to do this either with math or some built in function that returns points in the world along the length of my spawn blocks or something?

Thanks!

2 Likes