So im making a game where a train dives its self. On the train (model) i have a brick with a thruster script. I put a regen script on the train. It regens with the thruster BRICK. But now the script has stopped and i need the thruster script to regen with the train. Can someone help me?
Train regen script:
local regenTime = 50 local messageTime = 2.5
local model = script.Parent local message = Instance.new("Message")
--Check that the script hasn't been placed in workspace if model ~= workspace then message.Text = "Regenerating " .. model.Name
local backup = model:clone() -- Make the backup while true do wait(regenTime) --Remove the model model:Destroy() --Show the message message.Parent = game.Workspace wait(messageTime) message.Parent = nil --Copy the backup model = backup:clone() model.Parent = game.Workspace model:makeJoints() end
else error("Script not put in a model! Nothing to regenerate!") end
There is no problem with the script above. Below is the thruster script (the script that im trying to add a While loop into.)
game.Workspace.Part.RocketPropulsion.Target = game.Workspace.Train game.Workspace.Part.RocketPropulsion:fire() script.Parent.Touched:connect(function(hit) end) local a = hit.Parent and hit.Parent:findFirstChild("Humanoid") if a ~= nil then end then local rocket = game.Lighting.Rocket:clone() rocket.Position = Vector3.new(0, 20000, 0) -- drop out of sky rocket.RocketPropulsion.Target = hit rocket.Parent = game.Workspace wait(5.01) rocket.RocketPropulsion:fire() while a do end
(The script does work but it wont regen) Remeber i need this script to regen its self at the same time with the train somehow Can someone please help me im new to scripting Thanks, Jack111399
[Update]
So I've made a lot of adjustments to my thruster script. Here is the latest version of the script.
while wait (30.0) do game.Workspace.Model.Part.RocketPropulsion.Target = game.Workspace.Model.Part function fire() game.Workspace.Model.Part.RocketPropulsion.Target () end game.Workspace.Model.Part.RocketPropulsion.MaxThrust = Vector3.new(0, 20, 0) wait(5.0) end
There are no errors in the thruster script above. Its parent is rocket propulsion. The regen script is still the same. Anyone reading this please do this, go into your game and take a model (Like a group of bricks) and put Part into this model. Make sure part is one of Models children. Insert rocket Propulsion into Part and the child of rocket Propulsion is this thruster script. Modify this script to work with your model if you need to. Also make sure one of the Models children is the regen script posted above in the other post i made. My problem is that when my Model (Train) regens it no longer thrusts anymore. So can someone help fix this please. Thanks - Jack111399
http://www.roblox.com/Forum/ShowPost.aspx?PostID=155924051