Talk:Vehicles

F-22 Raptor and Mobile Suit fixing
Lately there have been problems on ROBLOX with scripts for my Mobile Suits (Gundams) on ROBLOX and have been showing nothing but delayed turning. If anything the aircraft seats i've applied to most Mobile Suits have scripts identical to YE015's F-22 Raptor. If anything I didn't copy these, and also I don't want to replace the cockpits of my Mobile Suits with either my old hover seats and lava bricks applied to the weapons, or work night and day on new scripts!

nd96 (my) Mobile Suits and YE015's F-22 Raptor
bin = script.Parentplane = nilhold = falselocal debounce = falselocal planedebounce = falselocal stuntdebounce = falselocal controlling = falselocal currentspeed = 0local turn = nilfly = false local missile = falselocal shooting = false function fire(gun_Source, player)missile = truelocal guns = gun_Source:GetChildrenfor i = 1,#guns doif guns[i].Name == "RocketLauncher" and guns[i].className == "Part" thenlocal shoot = Instance.new("Part")shoot.BrickColor = BrickColor.new("Really black")shoot.formFactor = "Plate"shoot.Size = Vector3.new(1,0.4,2)shoot.CFrame = guns[i].CFrame * CFrame.new(0,0,-5)shoot.Name = "Missile"local d = game:GetService("Debris")d:AddItem(shoot,15) local force = Instance.new("BodyVelocity")force.Parent = shootforce.Name = "Move"local x1 = guns[i].Velocity.xlocal y1 = guns[i].Velocity.ylocal z1 = guns[i].Velocity.zforce.velocity = Vector3.new(x1+(x1/10),y1+(y1/10),z1+(z1/10)) local creator = Instance.new("ObjectValue")creator.Name = "creator"creator.Value = playercreator.Parent = shoot local swoosh = script.Parent:findFirstChild("Swoosh"):cloneswoosh.Parent = shootswoosh:playlocal boom = script.Parent:findFirstChild("Explosion"):cloneboom.PlayOnRemove = trueboom.Parent = shoot local rocket = script:findFirstChild("RocketScript"):clonerocket.Disabled = falserocket.Parent = shoot shoot.Parent = Workspaceendendscript.Parent:findFirstChild("Reload"):playlocal swish = script.Parent:findFirstChild("FireRocket")swish:playfor i = 1,28 dowaitswish.Volume = swish.Volume - 0.025endswish:stopswish.Volume = 0.7wait(1)missile = falseend function fire_MachineGun(gun_Source, player)while shooting == true domissile = truelocal guns = gun_Source:GetChildrenfor i = 1,#guns doif guns[i].Name == "MachineGun" and guns[i].className == "Part" thenlocal shoot = Instance.new("Part")shoot.BrickColor = BrickColor.new("Bright yellow")shoot.formFactor = "Custom"shoot.Size = Vector3.new(0.4,0.4,2)shoot.CFrame = guns[i].CFrame * CFrame.new(0,0,-5)shoot.Name = "Bullet"local d = game:GetService("Debris")d:AddItem(shoot,5) local force = Instance.new("BodyVelocity")force.Parent = shootforce.Name = "Move"force.velocity = guns[i].CFrame.lookVector * 750 local creator = Instance.new("ObjectValue")creator.Name = "creator"creator.Value = playercreator.Parent = shoot local shot = script:findFirstChild("GunScript"):cloneshot.Disabled = falseshot.Parent = shoot shoot.Parent = Workspaceendendscript.Parent:findFirstChild("FireGun"):playwait(0.15)endmissile = falseend function computeDirection(vec)local lenSquared = vec.magnitude * vec.magnitudelocal invSqrt = 1 / math.sqrt(lenSquared)return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt)end function move(point, engine)local origincframe = engine:findFirstChild("Direction").cframesize = engine.Size target = engine.Position+((point - engine.Position).unit*100)local dir = (target - engine.Position).unitlocal spawnPos = engine.Positionleft = engine.CFrame*CFrame.new(-size.x/2, 0, 0).pright = engine.CFrame*CFrame.new(size.x/2, 0, 0).pmd = (target - engine.Position).magnitude foebmd = engine.CFrame*CFrame.new(0, 0, -md).ptoleft = (target -left).magnitudetoright = (target -right).magnituderot = ((foebmd - target).magnitude/10)local pos = spawnPos + (dir * 1)turn = math.rad((rot/10)*engine.TiltFactor.Value)if turn > math.rad(89) thenturn = math.rad(89)endif toleft rot thenengine:findFirstChild("Direction").cframe = CFrame.new(pos, pos + dir)*CFrame.fromEulerAnglesXYZ(0, 0, turn)elseif toleft > toright and toright >rot thenengine:findFirstChild("Direction").cframe = CFrame.new(pos,  pos + dir)*CFrame.fromEulerAnglesXYZ(0, 0, -turn)elseengine:findFirstChild("Direction").cframe = CFrame.new(pos,  pos + dir)endengine:findFirstChild("Direction").P = engine.TurnSpeed.Valueend function findPlane(player)local list = player.Character:GetChildrenfor x = 1, #list doif (list[x].Name == "AircraftSeat") thenreturn list[x]endendreturn nilend function onButton1Down(mouse)local vehicle = findPlane(script.Parent.Parent.Parent)if vehicle ~= nil and debounce == false and planedebounce == false thenif fly == false and taxi == false then return enddebounce = true controlling = true while true dowaitlocal engine = vehiclelocal position = mouse.Hitlocal target = position.pmove(target, engine)if planedebounce == true orcontrolling == false then break endendwait(0.1)debounce = falseendend function onButton1Up(mouse)controlling = falseend function onSelected(mouse)mouse.Icon = "http://www.roblox.com/asset/?id=7419350"game.Workspace.CurrentCamera.CameraSubject = bin.Parent.Parent.Character.Headgame.Workspace.CurrentCamera.CameraType = "Track"mouse.Button1Down:connect(function onButton1Down(mouse) end)mouse.Button1Up:connect(function onButton1Up(mouse) end)mouse.KeyDown:connect(onKeyDown)mouse.KeyUp:connect(onKeyUp)mouse.Move:connect(function Fly(mouse) end)mouse.Idle:connect(function Fly(mouse) end)end function onDeselected(mouse)game.Workspace.CurrentCamera.CameraSubject = bin.Parent.Parent.Character.Humanoidgame.Workspace.CurrentCamera.CameraType = "Custom"end function Fly(mouse)local vehicle = findPlane(script.Parent.Parent.Parent)if (vehicle==nil) then return endvehicle.Thrust.velocity = (vehicle.CFrame.lookVector * currentspeed) + Vector3.new(0,vehicle.LiftTrim.Value/100,0)end function onKeyDown(key)if (key~=nil) thenkey = key:lowerlocal vehicle = findPlane(script.Parent.Parent.Parent)if (vehicle==nil) then return endif key == "y" thenfly = truevehicle.Direction.cframe = vehicle.CFramevehicle.Direction.maxTorque = Vector3.new(4e3,4e3,4e3)vehicle.Thrust.maxForce = Vector3.new(9e20,9e20,9e20)while fly == true doif currentspeed < vehicle.Speed.Value thencurrentspeed = currentspeed + 1elseif currentspeed > vehicle.Speed.Value thencurrentspeed = currentspeed - 1endif vehicle.Acceleration.Value > 1000 then vehicle.Acceleration.Value = 1000 endwait((1-(vehicle.Acceleration.Value/1000))+0.01)if fly == false then break endendendif key == "x" thenfly = falsecurrentspeed = 0vehicle.Direction.maxTorque = Vector3.new(0,0,0)vehicle.Thrust.maxForce = Vector3.new(0,0,0)endif key == "w" thenif vehicle.Speed.Value < vehicle.MaxSpeed.Value thenvehicle.Speed.Value = vehicle.Speed.Value + 10endendif key == "s" thenif vehicle.Speed.Value > -10 thenvehicle.Speed.Value = vehicle.Speed.Value - 10endendif key == "p" thenvehicle.Speed.Value = vehicle.MaxSpeed.Valueendif key == ";" thenvehicle.Speed.Value = 0endif (key=="'") and (bin.Locked.Value == false) thenlocal repl = script:clonerepl.Parent = binwait(1)script:removeendif key == "l" and fly == true thenvehicle.Direction.maxTorque = Vector3.new(4e3,0,4e3)local frame = vehicle:FindFirstChild("OriginCFrame")if frame ~= nil thenvehicle.Direction.cframe = frame.Valueendwait(2)vehicle.Direction.cframe = vehicle.CFramevehicle.Direction.maxTorque = Vector3.new(4e3,4e3,4e3)endif key == "f" and missile == false thenfire(vehicle, bin.Parent.Parent)endif key == "c" and missile == false thenshooting = truefire_MachineGun(vehicle, bin.Parent.Parent)endendend function onKeyUp(key)if (key~=nil) thenkey = key:lowerif key == "c" thenshooting = falseendlocal vehicle = findPlane(script.Parent.Parent.Parent)if (vehicle==nil) then return endendend bin.Selected:connect(onSelected)bin.Deselected:connect(onDeselected)