Im trying to do what the title says. I have a target position and what Im trying to do is generate a position 8 studs away from it in the x,z direction. So imagine a circle with a radius of 8 studs and I’m trying to get a random point on that circle.
local direction = CFrame.Angles(math.rad(math.random(0,90)), 0, math.rad(math.random(0,90)))|
clangorFight.Clangor.Humanoid:MoveTo(getGoalPosition() + direction*8)|
The error I’m getting from this is
invalid argument #2 (Vector3 expected, got number)
You should be using :PivotTo() instead of :MoveTo()
:PivotTo will take a CFrame (which I see ‘direction’ is)
but when you do getGoalPosition() + direction, if getGoalPosition is returning a CFrame, you can’t add a CFrame + a CFrame, it wants the second value to get a Vector3
CFrame + Vector3 is what it needs, but I think you are doing CFrame + CFrame
local startPosition = getGoalPosition()
local directionCFrame = CFrame.Angles(math.rad(math.random(0,90)),0,math.rad(math.random(0,90)))
local endPosition = startPosition + (directionCFrame.LookVector*8)
if this is for a humanoid to walk to a position, you might be working with a flat surface, or floor, so maybe you are wanting to only rotate around the Y axis
such as
local directionCFrame = Frame.Angles(0,math.rad(math.random(0,90)),0)