Problem. How would I tell every time it moves? I have to detect for it to hit something.
Oh I forgot to mention. I need it to go up, and out and then go down to the ground
The Origin is the Center of the World, or 0, 0, 0, you then to get a Random Direction for it to Follow.
local origin = Vector3.zero -- 0, 0, 0
local rmd = Random.new() -- psuedorandom
local Direction = rmd:NextUnitVector() -- Returns a Random Direction
For you to Detect whether it hit something, you would most likely need to Raycast to do it, which you would need to Cast based on its position, and then by the Direction its going, if your Raycast was Successful, you can stop the Part, as to check if its Moving, you can have a Variable called IsMoving and when a Ray Intersects something, say its false, if you want it to go backwards you can then Reverse the Direction (-Direction) and have it go back.
to detect if it moves you can use RunService and check if part.Position ~= previousPosition (use variable to store previous position). And then connect RunService with Heartbeat so it’ll loop constantly, then if you want make it print("Part moved to: " … tostring(part.Position)) to check where part moved.
If you need it to go to the ground then use another tween and make it’s position to the ground