How to get a random point within the radius of the Part

Hello everyone,

I want to know how to get a random point within a part’s radius. I have searched everywhere but none worked for me or I couldn’t implement them correctly.

here is what I have currently:

	local Radius = 30
	local HouseFloorBoundries =, 1.165, 23.736)

	local Part ="Part",workspace)
	Part.Transparency = 1
	Part.CanCollide = false
	Part.Anchored = true

		local X = math.random(0,Radius)
		local Z = math.random(0,Radius)
		Part.Position = HouseFloorBoundries +,1.5,Z)
		local Distance = (Part.Position - PrimaryPart.Position).Magnitude
	until Distance >= 15

however the code above only seems to get a point in one corner of the part and ignore the other 3
is there something wrong with the code? Thanks for your time

So it works but only once? If so then you could try repeating 4 times?

It does work. However,

it only chooses an area within the green part and ignore all the parts for some reason so it’s not truly random

I’m not exactly sure what your layout is so I can’t exactly help, the only thing I see is the distance is using the PrimaryPart.Position, other than that I can’t really help.

The reason is because your random selection starts at 0 from the center:

Change math.random(0, Radius) to math.random(-Radius, Radius) and it will pick a random location within the part.

PS: task.wait(0.000001) doesn’t do anything; you might as well use task.wait() as it will be the smallest it can go.

Also, why the repeat until Distance >= 15?