So I figured how to make realistic throttles, but now when I regen my chassis, well, it all falls apart. I have a weld script in but it just keeps falling apart.
The code in the regen is:
local Engine = script.Parent.Parent["Model"] local CloneTrain = Engine:clone() Button = script.Parent.Parent.WCSpawn function spawnTrain() if Button.BrickColor == BrickColor.new(104) then local Model = CloneTrain:Clone()--Clones the backup so the script doesn't break Model:MakeJoints() --Makes it so the model doesn't fall apart. Model.Parent = game.Workspace --Puts the model into the game Button.BrickColor = BrickColor.new(26) wait(45) Button.BrickColor = BrickColor.new(104) end end script.Parent.ClickDetector.MouseClick:connect(spawnTrain)
Here are images:
Normal: https://gyazo.com/4f701374e6fed020144e29873ad3f97a
Regened: https://gyazo.com/9894b23d8f52114d3bc851fc618fbd26
All I did was switch the lines 7 and 8 positions, it should be working now:
local Engine = script.Parent.Parent["Model"] local CloneTrain = Engine:clone() Button = script.Parent.Parent.WCSpawn function spawnTrain() if Button.BrickColor == BrickColor.new(104) then local Model = CloneTrain:Clone()--Clones the backup so the script doesn't break Model.Parent = game.Workspace --Puts the model into the game Model:MakeJoints() --Makes it so the model doesn't fall apart. Button.BrickColor = BrickColor.new(26) wait(45) Button.BrickColor = BrickColor.new(104) end end script.Parent.ClickDetector.MouseClick:connect(spawnTrain)