-- Greeting, So due to Roblox adding an updates years ago with Roblox physics it has effected Roblox coasters and most of devs that make them moved to c-frame coasters but its very tricky to make the cart move around the track. --
--For example Theme park tycoon follows that pattern where it makes there coasters with c-framing so the coaster doesn't break and it moves around the track. But most of us aren't scripting genius's and are trying to find out how to make it through other questions but its very confusing and i have no script that has worked on one of my rides previously. I have read multiple things trying to make them work.--
--Someone by the name Mattscy has answered the question but in a confusing way. if anyone has any script that can make it as easy as possible can you comment the answer down below? thank you for your time.--
Photo of the coaster track to see what I'm working with: https://gyazo.com/e5dc021c2958c681f23a5b26a99a603f--
Here is Mattscy's script
local function StartCoaster(Coaster,RailModel)
local Rails = RailModel:GetChildren()
--sort rails table from lowest number name to highest number name:
table.sort(Rails,function(a,b)
return tonumber(a.Name) < tonumber(b.Name)
end)
for RailNum,Rail in pairs(Rails) do --go through ordered rails
for _,Segment in pairs(Coaster:GetChildren()) do
local GoalRail = Rails[RailNum + tonumber(Segment.Name)]
TweenModel(Segment, GoalRail.CFrame) --handle tweening here
end
wait(TweenTime) --change to time taken for tween
end
end
StartCoaster(workspace.Coaster, workspace.RailParts)
