Make dummy move into a range

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I would like to be able to make the dummy move randomly, but give limits to those movements.
    The dummy cannot go over a certain distance.

  2. What is the issue? Include screenshots / videos if possible!
    Idk where to start on scripting it.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    found nothing

function getRandomPointInCircle(centerPosition, circleRadius)
	
	local random = Random.new()
	
	local radius = math.sqrt(random:NextNumber()) * circleRadius
	local angle = random:NextNumber(0, math.pi * 2)
	local x = centerPosition.X + radius * math.cos(angle)
	local z = centerPosition.Z + radius * math.sin(angle)

	local position = Vector3.new(x, centerPosition.Y, z)

	return position
end

This would return a random point inside a circle with a set radius

1 Like

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