I am reasonably new to Roblox studio and I am trying to make a train system. I would like to have a wheel(s) that follow another model (the track) and the rail inside that. this means when you apply movement via vector forces or change CFrame
scripts, you want each wheel to follow the rail, applying a turning effect. The moving part also needs to be anchored. EDIT: Here is the bogie I have so far:
I haven’t tried a lot as I’m not sure where to start.
Maybe something along these lines:
local function position_wheel(object,wheel):
if wheel:IsA("BasePart") and object:IsA("BasePart") then
wheel.Position=object.PivotPoint.Position+Vector3(0,.2,0)
for w in pairs(workspace) do
if w:IsA("Model") or w:IsA("BasePart") then
local objecT=w.Touched:Connect(function(part)
position_wheel(object,w)
Note: This code does not contain any name checks, this is purely for example. Do not copy and paste without editing the code!
Any suggestions would be greatly appreciated.