Spawn Part on Floor

So I’m trying to code a move for my game where when you press a button, a part spawns in front of the player, but id like to make it not spawn inside of a part if there is one in front of the player. Id like for it to spawn on the ground, either above or below where the player is. Like this.


Any help is appreciated!

Probably you could pull this off by raycasting from a part in the sky down below and see where it hits the ground, then place the part.

2 Likes

thats actually a pretty good idea! ill try it