Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

Why isn't this working?

Asked by 10 years ago

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?

2 answers

Log in to vote
0
Answered by 10 years ago

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 385 — 10y
0
No problem, if my answer worked for you could you please mark it as the correct answer? Scriptury 70 — 10y
Ad
Log in to vote
0
Answered by
Bebee2 195
10 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

Answer this question