Hey fellow developers,
I’m currently trying to develop a system that’ll make life easier when making Train Simulators, by that I mean I’m creating a node based tracking system that makes “bogies” follow a single rail. I’ve made it so that you can set the distance between bogies using a NumberValue too. Everything works well so far, but I seem to have run into a problem; I don’t know what is happening but randomly the weld part (The Middle Part) just disappears, completely gone from the workspace. I’ve come a cross this before and I simply check to see if the CFrame wasn’t nil, but that has not worked in this situations, and I’m just stumped.
I’ve been at this since April and recently started again due to some advice from @BanTech on another thread. So help with other aspects of the project would be greatly appreciated.
This is the only section that interacts with that weld part.
RS.Heartbeat:connect(function()
CentralPoint = (Bogie1.Position + Bogie2.Position) / 2
Root:SetNetworkOwner(nil)
local newRootCFrame = CFrame.new(CentralPoint, Bogie1.Position)
print("============================")
print(newRootCFrame.LookVector)
print(newRootCFrame.RightVector)
print(newRootCFrame.UpVector)
print(newRootCFrame.Position)
print("============================")
if newRootCFrame.Position == newRootCFrame.Position then
Root.CFrame = newRootCFrame
else
print("lol")
end
end)
Thank you for your time.