How would you spawn a part outside of a certain area (at a random spot /w math.random), in an area?

  1. I want to spawn a part outside of the safe zone (at a random spot /w math.random), in an area but don’t know how.

Example:
Help

  1. It is to confusing and I don’t know how to figure it out.

There are invisible parts filling the four sides of the save zone

If anyone knows how to do this then please tell me.

Thank you!!

Edit: I found a solution to this. Thank you for you help.

1 Like

Let’s say your spawn place is X(-10,10) and Z(-10,10).

You can set x and z variables to math.random() but you do this in a repeat until loop, and you repeat it until (in my example), X<-10 and X> 10 and Z<-10 and Z> 10

Hope this helps!

I don’t know about this because I never tried, but maybe you could say to the script to not spawn in a certain region? Spawn.Position ~= Region3.new(math.random(),math.random(),math.random()), this code likely won’t help (but just maybe), but it’s an example anyway, nope this helped!