So I just need a system that moves a model randomly in an area(I have working) but ALSO faces the direction it moves. I can get it moving just fine, but if I try to add a direction to the CFrame is bugs out.
Here is the Error:
Workspace.Map.Home.PetHouse.Cat.Body.Script:23: Expected ')' (to close '(' at column 24), got ','
As far as I understand CFrame can point like this
CFrame.new(Pos, Rot)
But apparently I am wrong because I try to give it the target to rotate to and it wont accept it.
Here is the code:
local character = script.Parent.Parent
local crame = character.PrimaryPart.CFrame
local base = character.Parent.Base
local sizeX, sizeZ = base.Size.X/2, base.Size.Z/2
local tweenService = game:GetService("TweenService")
local info = TweenInfo.new()
local xf = character.PrimaryPart.CFrame.X
local zf = character.PrimaryPart.CFrame.Z
local cf = Instance.new("CFrameValue")
local function tweenpls(CF)
local xspot = (xf + math.random(-sizeX, sizeX))
local zspot = (zf +math.random(-sizeZ, sizeZ))
local vpos = Vector3.new(xspot, 2.124, zspot)
local tween = tweenService:Create(
CF,
TweenInfo.new(),
{CFrame = CFrame.new((xspot, 2.124, zspot), vpos)}
)
tween:Play()
end
while true do
wait(2)
--tweenModel(character.PrimaryPart, pos, vpos)
tweenpls(character.PrimaryPart)
crame = character.PrimaryPart.CFrame
end
Not sure what it wants from me, I have tried turning the first parameter into its own CFrame.new and then it expects a vector 3, I try that and the model disappears and seems to start soaring around the map. Any help would be appreciated

1 comment
Then a different error occurs ""Expected ')' (to close '(' at column 24), got ',' it basically doesn't want a second parameter there despite it should be reading it as the rotation value for the CFrame. At least is how i'm understanding it.