- local cesna = workspace:WaitForChild("Cessna 172")
- local rs = game:GetService("RunService")
- local propeller = cesna:WaitForChild("Propeller")
- --local speed = 0 -- Number has to be from 1 to 10 times 10
- local direction = cesna:WaitForChild("Direction")
- local repstrg = game:GetService("ReplicatedStorage")
- local spin = repstrg:WaitForChild("Spin")
- local move = repstrg:WaitForChild("Move")
- local nosedown = repstrg:WaitForChild("NoseDown")
- local noseup = repstrg:WaitForChild("NoseUp")
- local turnright = repstrg:WaitForChild("TurnRight")
- local turnleft = repstrg:WaitForChild("TurnLeft")
- local body = cesna:WaitForChild("Body")
- local seat = cesna:WaitForChild("Seat")
- local campart = cesna:WaitForChild("CameraPart")
- local knot = 1000
- local spinning = false
- local brakes = false
- local sped = 10
- local bg
- local bv
- local bav
- local pilotin = false
- local inmode = false
- function spinningblade(spd)
- while spinning == true do
- propeller.CFrame = propeller.CFrame * CFrame.fromEulerAnglesXYZ(spd,0.0,0.0)--changed it
- wait()
- end
- end
- spin.OnServerEvent:Connect(function(plr, speed)
- spinning = not spinning
- spinningblade(speed)
- end)
- move.OnServerEvent:Connect(function(plr)
- while spinning == false and brakes == false and seat:FindFirstChild("SeatWeld") do
- pilotin = true
- wait()
- for i,v in pairs(cesna:GetChildren())do
- if v.Name == "Body" and v:FindFirstChild("BodyVelocity") == nil and v:FindFirstChild("BodyAngularVelocity") == nil then
- bv = Instance.new("BodyVelocity")
- bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
- bv.Parent = v
- ------------
- bg = Instance.new("BodyGyro")
- bg.MaxTorque = Vector3.new(0,0,0)
- bg.Parent = v
- --------------
- while wait(0.1) do
- local x = direction.CFrame.LookVector.X*(knot/10)
- local y = direction.CFrame.LookVector.Y*(knot/10) --direction.CFrame.LookVector.Y
- local z = 0 --direction.CFrame.LookVector.Z
- bv.Velocity = Vector3.new(x,y,z)
- end
- end
- end
- end
- end)
- noseup.OnServerEvent:Connect(function(plr, degree) --pointing nose up
- body.CFrame = body.CFrame * CFrame.Angles(math.rad(0),math.rad(0),math.rad(degree))
- end)
- nosedown.OnServerEvent:Connect(function(plr, degree) -- pointing nose down
- body.CFrame = body.CFrame * CFrame.Angles(math.rad(0),math.rad(0),math.rad(-degree))
- end)
- turnleft.OnServerEvent:Connect(function(plr, dg)
- if pilotin == true then
- body.CFrame = body.CFrame * CFrame.Angles(math.rad(0),math.rad(dg),math.rad(0))
- end
- end)
- turnright.OnServerEvent:Connect(function(plr, dg)
- if pilotin == true then
- body.CFrame = body.CFrame * CFrame.Angles(math.rad(0),math.rad(-dg),math.rad(0))
- end
- end)
- --(direction.CFrame.LookVector*sped)