Hi there!
I am trying to make a train simulator. I know what I am doing in regards to making the train move along a track. I am also aware on how to control the doors to work, so when you press a button, a FOR loop changes the CFrame of multiple objects in specified directions.
However the doors do work (in their own isolated model), as you have seen in the video linked above. However as soon as I place a block beneath, model the part to the model so the tree looks like:
-Model - Part - Train Model - Train Door's parts
Then I weld that part to the door parts. And press the button to open the doors. The door and the part attached completely bugs out and flies away.
Please help me, I've been stuck on this for DAYS.
The OPEN DOOR script
locked = script.Parent.Parent.Locked open = script.Parent.Parent.OpenValue door = script.Parent.Parent.Door left = door.left right = door.right function onClick() if locked.Value == true then return elseif locked.Value == false then if open.Value == false then open.Value = true for i=1, 21 do stuff = right:GetChildren() stuffL = left:GetChildren() for i=1, #stuff do if (stuff[i].className == "Part") or (stuff[i].className == "WedgePart") or (stuff[i].className == "UnionOperation") then if (stuff[i].Name ~= "Button") then stuff[i].CFrame = stuff[i].CFrame * CFrame.new(0.1,0,0) end end end for i=1, #stuffL do if (stuffL[i].className == "Part") or (stuffL[i].className == "WedgePart") or (stuffL[i].className == "UnionOperation") then if (stuffL[i].Name ~= "Button") then stuffL[i].CFrame = stuffL[i].CFrame * CFrame.new(-0.1,0,0) end end end wait(0) end elseif open.Value == true then return end end end script.Parent.Click.MouseClick:Connect(onClick)