I’m not good with scripting at all, so i’m gonna need some major help.
I have this really old broken plane here that i’d like to get up off the ground once again in, and i’m not sure what to do. here is the link to the asset.
This plane needs a tool, but i’d like to re-write the plane so that it no longer needs this tool.
Even without the tool, the plane has seriously aged and code is beyond obsolete. I was wondering if anyone could help me rewrite and simplify the code so that it works once again.
Again, I am not very familiar with code but trying desperately to learn to with all this time during the pandemic.
so with that being said, here is a screenshot of the layout of the model:
Here is the script that is the child of “Fighter”:
local boom = false function createExplosion(position) explosion = Instance.new("Explosion") explosion.Position = position explosion.BlastRadius = 12 explosion.Parent = game.Workspace end function onTouch(part) if boom == true then return end if (part.Name == "Rocket") or (part.Name == "Safe") or (part.Parent.Parent.Parent == script.Parent) or (part.Parent:findFirstChild("Humanoid")) then return end if (script.Parent.Parts.Tip.Velocity.x > 50) or (script.Parent.Parts.Tip.Velocity.x < -50) or (script.Parent.Parts.Tip.Velocity.z > 50) or (script.Parent.Parts.Tip.Velocity.z < -50) then boom = true createExplosion(script.Parent.Parts.Engine.Position) script.Parent:BreakJoints() local stuff = script.Parent:children() for i=1,#stuff do if stuff[i].Name == "BodyKit" or stuff[i].Name == "Parts" then local parts = stuff[i]:children() for p = 1, #parts do if parts[p].className == "Part" then local velo = Instance.new("BodyVelocity") velo.maxForce = Vector3.new(9.9e+036, 9.9e+036, 9.9e+036) velo.velocity = Vector3.new(math.random(-15,15),math.random(-15,15),math.random(-15,15)) velo.Parent = parts[p] end end end end wait(4) script.Parent:remove() end end script.Parent.Parts.Tip.Touched:connect(onTouch)
And here is the script under “Parts”:
position = script.Parent.Engine.Position local frame = Instance.new("CFrameValue") frame.Name = "OriginCFrame" frame.Value = script.Parent.Engine.CFrame frame.Parent = script.Parent local object = Instance.new("ObjectValue") object.Value = script.Parent.Parent.Parent seat = script.Parent.Seat function onChildAdded(part) if part.className == "Weld" then local torso = part.Part1 if torso ~= nil then local parent = torso.Parent if parent ~= nil then script.Parent.Parent.Parent = parent while true do wait(2) local pos = script.Parent.Engine.Position if (position - pos).magnitude > 30 then if object.Value ~= nil then object.Value.Regen.Value = 1 wait(.5) object.Value.Regen.Value = 0 object.Value = nil end break end end while true do print("Loop") wait(2) if part == nil then script.Parent.Parent.Parent = game.Workspace script.Parent.Parent:MakeJoints() break end end end end end end seat.ChildAdded:connect(onChildAdded)
There is alot of stuff in the model “Parts”, but here is “Engine”, which has important components under it.
Here is the script under “Engine”:
model = script.Parent.Parent.Parent backup = model:clone() local debounce = false function onTouch(part) if (part.Name == "Safe") and (debounce == false) and (script.Parent.Count.Value == 0) then debounce = true wait(2) model = backup:clone() model.Parent = game.Workspace model:makeJoints() script.Parent.Count.Value = 1 debounce = false end end script.Parent.Touched:connect(onTouch)
That’s all. I’m cool with beginning anywhere, and even just thinning out the model itself, as you can see it’s a mess of CFrame values.