Hi so i made a script which tweens the position to childrens of a folder.
I want to make the part face toward the direction its going to, i dont know if this is clear enough but heres a video of what it looks like right now.
And as you see the rootPart of the bot(the part that makes the bot moves) is only facing one direction.
--> Gets robot's Y Position
local currentYPos = {}
if not table.find(currentYPos, script.Parent.RootPart) then
currentYPos[script.Parent.RootPart] = script.Parent.RootPart.Position.Y
end
local yPos = currentYPos[script.Parent.RootPart]
local addY = Vector3.new(0,yPos,0)
--> General tween settings
local tweenService = game:GetService("TweenService")
local instance = script.Parent.PrimaryPart
local tweenInfo = TweenInfo.new(2)
--> Applys tweens
local folder = workspace.Folder
for i,v in pairs(folder:GetChildren()) do
if v then
local goals = {}
local goal = {Position = v.Position + addY}
table.insert(goals, goal)
for i = 1, #goals do
local tween = tweenService:Create(instance, tweenInfo, goals[i])
tween:Play()
tween.Completed:Wait()
end
end
end