I’m trying to make a tween script that will tween the car to each of the waypoints.
Script:
local Car = script.Parent
local Humanoid = Car.Humanoid
local waypoints = workspace.Folder:GetChildren()
local ts = game:GetService('TweenService')
local primary = script.Parent.Brain
for i, p in pairs(Car:GetChildren()) do
if p:IsA('BasePart') and (p ~= primary) then
local weld = Instance.new('WeldConstraint',p)
weld.Part0 = p
weld.Part1 = primary
end
end
for i, waypoint in pairs(waypoints) do
local tweencreate = ts:Create(primary, TweenInfo.new(1,Enum.EasingStyle.Sine,Enum.EasingDirection.InOut,1000000000,false,0,{CFrame = primary.CFrame * waypoint.CFrame}))
tweencreate:Play()
end