Hello! I have a rollercoaster node system that drags a part around nodes, Something’s stumped me though, How could I add multiple carts to the system? Here’s my current code:
local TweenService = game:GetService("TweenService")
local Model = script.Parent.Parent
local Number = 1
local MaxNumber = 33
while wait() do
if Number == MaxNumber then
Number = 1
else
Number += 1
end
local PartToMoveTo = "Part"..Number
local PartSpeed = script.Parent.Parent.Parent.Nodes[PartToMoveTo].Speed.Value
local PartWait = script.Parent.Parent.Parent.Nodes[PartToMoveTo].WaitTime.Value
if PartWait ~= 0 then
wait(PartWait)
end
local TweenService = game:GetService("TweenService")
local Resize = script.Parent
local Goal = {}
Goal.CFrame = script.Parent.Parent.Parent.Nodes[PartToMoveTo].CFrame
local TwInfo = TweenInfo.new(
PartSpeed, -- Time
Enum.EasingStyle.Linear, -- EasingStyle
Enum.EasingDirection.InOut, -- EasingDirection
0, -- RepeatCount (when less than zero the tween will loop indefinitely)
false, -- Reverses (tween will reverse once reaching it's goal)
0 -- DelayTime
)
local Tween1 = TweenService:Create(Resize, TwInfo, Goal)
Tween1:Play()
Tween1.Completed:Wait()
end
Thank you in advance!