-1

# Why isn't this working?

Hi there guys. I am currently building an automated Train System, but I found out that there's a big problem. The Train clones perfectly, but immediately falls apart once I set the Parent to Workspace. The script works fine, but I don't know weather it is a building issue or if I am missing anything from the script?

-- Script is in the Workspace, Train(Model) is in lightning
train = game.Lightning.Train

while true do
train:Clone()
train.Parent = Workspace
wait(30)
end


Studio does not crash during the while loop. Once I play, Everything is fine until the train clones and it explodes everywhere like a bomb going off. Please Help?

0

All you need to do is call the MakeJoints method on it. Also you need to be careful with what you are parenting to the Workspace.

Here is the correct code:

train = game.Lighting.Train

while true do
local newTrain = train:Clone()
newTrain.Parent = Workspace
newTrain:MakeJoints()
wait(30)
end


If this doesn't work, you may need to weld things together.

0
Welded them before I scripted. Thanks for the help! fahmisack123 378 — 7y
0
No problem, if my answer worked for you could you please mark it as the correct answer? Scriptury 70 — 7y
0
Bebee2 195
7 years ago
train = game.Lighting.Train -- Not Lightning

while true do
local clone = train:clone()
clone:MakeJoints() -- Manually connect it using this method.
clone.Parent = workspace
clone:MakeJoints() -- Just in case. One more time.
wait(30)
end