How to Make a Plane/scripts
From Goodblox Wiki
Introduction
This page will contain the scripts from How to Make a Plane
Rocket Script
r = game:service("RunService") shaft = script.Parent position = shaft.Position function fly() direction = shaft.CFrame.lookVector position = position + 35*direction error = position - shaft.Position shaft.Velocity = 5*error end function blow() swoosh:stop() explosion = Instance.new("Explosion") explosion.Position = shaft.Position explosion.BlastRadius = 10 -- find instigator tag local creator = script.Parent:findFirstChild("creator") if creator ~= nil then explosion.Hit:connect(function(part, distance) onPlayerBlownUp(part, distance, creator) end) end explosion.Parent = game.Workspace connection:disconnect() wait(.1) shaft:remove() end function onTouch(hit) if hit.Name == "Building" or hit.Name == "Safe" then swoosh:stop() shaft:remove() return end local parent = hit.Parent.Parent local owner = shaft.Owner if owner ~= nil then if parent ~= nil and owner.Value ~= nil then if parent ~= owner.Value then local stunt = parent:FindFirstChild("Stunt") if stunt ~= nil then if stunt.Value ~= 1 then blow() end else blow() end end end end end function onPlayerBlownUp(part, distance, creator) if part.Name == "Head" then local humanoid = part.Parent:findFirstChild("Humanoid") tagHumanoid(humanoid, creator) end end function tagHumanoid(humanoid, creator) if creator ~= nil then local new_tag = creator:clone() new_tag.Parent = humanoid end end function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end t, s = r.Stepped:wait() swoosh = script.Parent.Swoosh swoosh:play() d = t + 4.0 - s connection = shaft.Touched:connect(onTouch) while t < d do fly() t = r.Stepped:wait() end -- at max range script.Parent.Explosion.PlayOnRemove = false swoosh:stop() shaft:remove()
There are plenty of things to change
function fly() direction = shaft.CFrame.lookVector position = position + 35*direction error = position - shaft.Position shaft.Velocity = 5*error end
You can play with the coefficients to make a projectile that flies faster or more slowly.
function blow() swoosh:stop() explosion = Instance.new("Explosion") explosion.Position = shaft.Position explosion.BlastRadius = 10 -- find instigator tag local creator = script.Parent:findFirstChild("creator") if creator ~= nil then explosion.Hit:connect(function(part, distance) onPlayerBlownUp(part, distance, creator) end) end explosion.Parent = game.Workspace connection:disconnect() wait(.1) shaft:remove() end
You can change BlastRadius if you want the rocket to make a bigger or smaller explosion.
d = t + 4.0 - s
Change 4.0 to the number of seconds you want the rocket to last if it doesn't hit anything before deleting itself.
You can also play with the Part "Rocket" itself, and make it a different colour, bigger, smaller, round, etc.
Cloaking Script
message = Instance.new("Hint") -- section one playerinplane = false while true do vehicle = script.Parent bodykit = vehicle.BodyKit:GetChildren() parts = vehicle.Parts player = vehicle.Parent -- section two if (vehicle.Cloaked.Value == 1) and (vehicle.CloakPercent.Value < 100) then vehicle.CloakPercent.Value = vehicle.CloakPercent.Value + 5 end if (vehicle.Cloaked.Value == 0) and (vehicle.CloakPercent.Value > 0) then vehicle.CloakPercent.Value = vehicle.CloakPercent.Value - 5 end -- section three if (vehicle.Cloaked.Value == 1) then vehicle.Energy.Value = vehicle.Energy.Value - 1 end if (vehicle.Cloaked.Value == 0) and (vehicle.CloakPercent.Value <= 0) and (vehicle.Energy.Value < 1000) then vehicle.Energy.Value = vehicle.Energy.Value + 1 end --section four if (vehicle.Cloaked.Value == 1) and (vehicle.Energy.Value <= 0) then vehicle.Cloaked.Value = 0 end if (vehicle.Cloaked.Value == 1) and (player.Humanoid.health <= 0) then vehicle.Cloaked.Value = 0 message:Remove() end local weld = parts:FindFirstChild("Seat"):FindFirstChild("SeatWeld") if (weld == nil) or (weld.Part1 ~= player:FindFirstChild("Torso")) then vehicle.Cloaked.Value = 0 message:Remove() end --section five if (vehicle.Energy.Value >= 950) then message.Text = "Energy for Cloak: (||||||||||)" elseif (vehicle.Energy.Value >= 850) and (vehicle.Energy.Value < 950) then message.Text = "Energy for Cloak: (||||||||| )" elseif (vehicle.Energy.Value >= 750) and (vehicle.Energy.Value < 850) then message.Text = "Energy for Cloak: (|||||||| )" elseif (vehicle.Energy.Value >= 650) and (vehicle.Energy.Value < 750) then message.Text = "Energy for Cloak: (||||||| )" elseif (vehicle.Energy.Value >= 550) and (vehicle.Energy.Value < 650) then message.Text = "Energy for Cloak: (|||||| )" elseif (vehicle.Energy.Value >= 450) and (vehicle.Energy.Value < 550) then message.Text = "Energy for Cloak: (||||| )" elseif (vehicle.Energy.Value >= 350) and (vehicle.Energy.Value < 450) then message.Text = "Energy for Cloak: (|||| )" elseif (vehicle.Energy.Value >= 250) and (vehicle.Energy.Value < 350) then message.Text = "Energy for Cloak: (||| )" elseif (vehicle.Energy.Value >= 150) and (vehicle.Energy.Value < 250) then message.Text = "Energy for Cloak: (|| )" elseif (vehicle.Energy.Value >= 50) and (vehicle.Energy.Value < 150) then message.Text = "Energy for Cloak: (| )" elseif (vehicle.Energy.Value < 50) then message.Text = "Energy for Cloak: ( )" end --section six for i = 1,#bodykit do bodykit[i].Transparency = vehicle.CloakPercent.Value / 100 end seat = parts:FindFirstChild("Seat") engine = parts:FindFirstChild("Engine") gun1 = parts:FindFirstChild("Gun1") gun2 = parts:FindFirstChild("Gun2") tip = parts:FindFirstChild("Tip") head = player:FindFirstChild("Head") torso = player:FindFirstChild("Torso") leftarm = player:FindFirstChild("Left Arm") leftleg = player:FindFirstChild("Left Leg") rightarm = player:FindFirstChild("Right Arm") rightleg = player:FindFirstChild("Right Leg") --section seven if (player.Name ~= "Station1") and (player.Name ~= "Station2") then if (playerinplane == false) then message.Parent = game.Players:FindFirstChild(player.Name) playerinplane = true body = player:FindFirstChild("Torso") head = player:FindFirstChild("Head") if (body ~= nil) then bodyshirt = body:FindFirstChild("roblox") if (bodyshirt ~= nil) then backupshirt = bodyshirt:clone() end end if (head ~= nil) then bodyface = head:FindFirstChild("face") if (bodyface ~= nil) then backupface = bodyface:clone() end end end if (vehicle.Cloaked.Value == 1) then body = player:FindFirstChild("Torso") head = player:FindFirstChild("Head") if (body ~= nil) then bodyshirt = body:FindFirstChild("roblox") if (bodyshirt ~= nil) then backupshirt = bodyshirt:clone() bodyshirt:Remove() end end if (head ~= nil) then bodyface = head:FindFirstChild("face") if (bodyface ~= nil) then bodyface:Remove() backupface = bodyface:clone() end end end if (vehicle.Cloaked.Value == 0) then body = player:FindFirstChild("Torso") head = player:FindFirstChild("Head") if (body ~= nil) then bodyshirt = body:FindFirstChild("roblox") if (bodyshirt == nil) and (backupshirt ~= nil) then bodyshirt = backupshirt:clone() bodyshirt.Parent = player.Torso end end if (head ~= nil) then bodyface = head:FindFirstChild("face") if (bodyface == nil) and (backupface ~= nil) then bodyface = backupface:clone() bodyface.Parent = player.Head end end end --section eight if (seat ~= nil) then seat.Transparency = vehicle.CloakPercent.Value / 100 end if (engine ~= nil) then engine.Transparency = vehicle.CloakPercent.Value / 100 end if (gun1 ~= nil) then gun1.Transparency = vehicle.CloakPercent.Value / 100 end if (gun2 ~= nil) then gun2.Transparency = vehicle.CloakPercent.Value / 100 end if (tip ~= nil) then tip.Transparency = vehicle.CloakPercent.Value / 100 end if (head ~= nil) then head.Transparency = vehicle.CloakPercent.Value / 100 end if (torso ~= nil) then torso.Transparency = vehicle.CloakPercent.Value / 100 end if (leftarm ~= nil) then leftarm.Transparency = vehicle.CloakPercent.Value / 100 end if (leftleg ~= nil) then leftleg.Transparency = vehicle.CloakPercent.Value / 100 end if (rightarm ~= nil) then rightarm.Transparency = vehicle.CloakPercent.Value / 100 end if (rightleg ~= nil) then rightleg.Transparency = vehicle.CloakPercent.Value / 100 end --Section nine end wait(0.1) end
Team Coloring Script
local boom = false local color_tag = script.Parent.PlaneColor 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 function onColorTagChanged(property) -- print("TagColor" .. property) -- if (property == "Value") then -- Color Ship local parts = script.Parent.BodyKit:GetChildren() for i = 1,#parts do if parts[i].className == "Part" and parts[i].Name == "ColorMe" then parts[i].BrickColor = color_tag.Value end end -- end end script.Parent.Parts.Tip.Touched:connect(onTouch) color_tag.Changed:connect(onColorTagChanged)
Sequential firing
--- The replacement firing script section if (key=="f") and (bin.Reload.Value == 0) then if plane.mode.Value == true then bin.Reload.Value = 1 fire(vehicle,plane.Gun1) fire(vehicle,plane.Gun2) plane.mode.Value = false wait(.25) bin.Reload.Value = 0 else bin.Reload.Value = 1 fire(vehicle,plane.Gun3) fire(vehicle,plane.Gun4) plane.mode.Value = true wait(.25) bin.Reload.Value = 0 end end --- The end of the replacement firing script section
Tool giver plane
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 onSitUp(child, hopper, plane) if child.Parent == nil then hopper.Parent = nil -- ungive flying tool plane.Parent = game.Workspace end end function onChildAdded(part) if part.className == "Weld" then local torso = part.Part1 if torso ~= nil then local char = torso.Parent local player = game.Players:GetPlayerFromCharacter(char) if player ~= nil then local hopper = game.Lighting.Plane:clone() -- Replace plane for the name of the flyinging tool hopper.Parent = player.Backpack part.AncestryChanged:connect(function(child) onSitUp(child, hopper, script.Parent.Parent) end) end 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)
Plane explosion
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)
Plane regeneration
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)
Bullets script one
function onTouched(hit) hit:BreakJoints() end connection = script.Parent.Touched:connect(onTouched)
Bullets script two
function shoot(pln,spn) local missile = script.Bullet:clone() missile.CFrame = spn.CFrame * CFrame.new(0, 0, -35) missile.RocketScript.Disabled = false missile.Parent = game.Workspace local creator_tag = Instance.new("ObjectValue") creator_tag.Value = game.Players.LocalPlayer creator_tag.Name = "creator" creator_tag.Parent = missile missile.Owner.Value = pln end
Bullets script three
if (key=="e") and (bin.Reload.Value == 0) then shoot(vehicle,plane.Gun1) shoot(vehicle,plane.Gun2) bin.Reload.Value = 1 wait(1) bin.Reload.Value = 0 end
Rocket into PlaneFlyer
function fire(pln,spn) local missile = script.Rocket:clone() missile.CFrame = spn.CFrame * CFrame.new(0, 0, -35) missile.RocketScript.Disabled = false missile.Parent = game.Workspace local creator_tag = Instance.new("ObjectValue") creator_tag.Value = game.Players.LocalPlayer creator_tag.Name = "creator" creator_tag.Parent = missile missile.Owner.Value = pln end
Homing missile
if (key=="Z") then if (bin.Reload.Value == 0) then if (homingtarget ~= nil) then if (homingtarget.Parent.Parent ~= vehicle) then firehomingmissile(vehicle,plane.MissileLauncher1) bin.Reload.Value = 1 wait(5) bin.Reload.Value = 0 end end end end
Fire function
function fire(pln,spn) local missile = bin.Rocket:clone() missile.CFrame = spn.CFrame * CFrame.new(0, 0, -35) missile.RocketScript.Disabled = false missile.Parent = game.Workspace local creator_tag = Instance.new("ObjectValue") creator_tag.Value = game.Players.LocalPlayer creator_tag.Name = "creator" creator_tag.Parent = missile missile.Owner.Value = pln end
Shot formations
function fire(pln,spn,x,y) local missile = bin.Rocket:clone() missile.CFrame = spn.CFrame * CFrame.new(x, y, -35) missile.RocketScript.Disabled = false missile.Parent = game.Workspace local creator_tag = Instance.new("ObjectValue") creator_tag.Value = game.Players.LocalPlayer creator_tag.Name = "creator" creator_tag.Parent = missile missile.Owner.Value = pln end
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)
Firing script section
if (key=="f") and (bin.Reload.Value == 0) then fire(vehicle,plane.Gun1) fire(vehicle,plane.Gun2) bin.Reload.Value = 1 wait(1) bin.Reload.Value = 0 end
Getting a plane tool
function fire(pln,spn) local missile = script.Rocket:clone() missile.CFrame = spn.CFrame * CFrame.new(0, 0, -35) missile.RocketScript.Disabled = false missile.Parent = game.Workspace local creator_tag = Instance.new("ObjectValue") creator_tag.Value = game.Players.LocalPlayer creator_tag.Name = "creator" creator_tag.Parent = missile missile.Owner.Value = pln end