Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --https://github.com/Mokiros/roblox-FE-compatibility
- if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
- local Player,game,owner = owner,game
- local RealPlayer = Player
- do
- print("FE Compatibility code V2 by Mokiros")
- local RealPlayer = RealPlayer
- script.Parent = RealPlayer.Character
- --Fake event to make stuff like Mouse.KeyDown work
- local Disconnect_Function = function(this)
- this[1].Functions[this[2]] = nil
- end
- local Disconnect_Metatable = {__index={disconnect=Disconnect_Function,Disconnect=Disconnect_Function}}
- local FakeEvent_Metatable = {__index={
- Connect = function(this,f)
- local i = tostring(math.random(0,10000))
- while this.Functions[i] do
- i = tostring(math.random(0,10000))
- end
- this.Functions[i] = f
- return setmetatable({this,i},Disconnect_Metatable)
- end
- }}
- FakeEvent_Metatable.__index.connect = FakeEvent_Metatable.__index.Connect
- local function fakeEvent()
- return setmetatable({Functions={}},FakeEvent_Metatable)
- end
- --Creating fake input objects with fake variables
- local FakeMouse = {Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent(),Button2Up=fakeEvent(),Button2Down=fakeEvent()}
- FakeMouse.keyUp = FakeMouse.KeyUp
- FakeMouse.keyDown = FakeMouse.KeyDown
- local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
- local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
- CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
- end}
- --Merged 2 functions into one by checking amount of arguments
- CAS.UnbindAction = CAS.BindAction
- --This function will trigger the events that have been :Connect()'ed
- local function TriggerEvent(self,ev,...)
- for _,f in pairs(self[ev].Functions) do
- f(...)
- end
- end
- FakeMouse.TriggerEvent = TriggerEvent
- UIS.TriggerEvent = TriggerEvent
- --Client communication
- local Event = Instance.new("RemoteEvent")
- Event.Name = "UserInput_Event"
- Event.OnServerEvent:Connect(function(plr,io)
- if plr~=RealPlayer then return end
- FakeMouse.Target = io.Target
- FakeMouse.Hit = io.Hit
- if not io.isMouse then
- local b = io.UserInputState == Enum.UserInputState.Begin
- if io.UserInputType == Enum.UserInputType.MouseButton1 then
- return FakeMouse:TriggerEvent(b and "Button1Down" or "Button1Up")
- end
- if io.UserInputType == Enum.UserInputType.MouseButton2 then
- return FakeMouse:TriggerEvent(b and "Button2Down" or "Button2Up")
- end
- for _,t in pairs(CAS.Actions) do
- for _,k in pairs(t.Keys) do
- if k==io.KeyCode then
- t.Function(t.Name,io.UserInputState,io)
- end
- end
- end
- FakeMouse:TriggerEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
- UIS:TriggerEvent(b and "InputBegan" or "InputEnded",io,false)
- end
- end)
- Event.Parent = NLS([==[local Event = script:WaitForChild("UserInput_Event")
- local Mouse = owner:GetMouse()
- local UIS = game:GetService("UserInputService")
- local input = function(io,RobloxHandled)
- if RobloxHandled then return end
- --Since InputObject is a client-side instance, we create and pass table instead
- Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
- end
- UIS.InputBegan:Connect(input)
- UIS.InputEnded:Connect(input)
- local h,t
- --Give the server mouse data every second frame, but only if the values changed
- --If player is not moving their mouse, client won't fire events
- local HB = game:GetService("RunService").Heartbeat
- while true do
- if h~=Mouse.Hit or t~=Mouse.Target then
- h,t=Mouse.Hit,Mouse.Target
- Event:FireServer({isMouse=true,Target=t,Hit=h})
- end
- --Wait 2 frames
- for i=1,2 do
- HB:Wait()
- end
- end]==],script)
- ----Sandboxed game object that allows the usage of client-side methods and services
- --Real game object
- local RealGame = game
- --Metatable for fake service
- local FakeService_Metatable = {
- __index = function(self,k)
- local s = rawget(self,"_RealService")
- if s then
- return typeof(s[k])=="function"
- and function(_,...)return s[k](s,...)end or s[k]
- end
- end,
- __newindex = function(self,k,v)
- local s = rawget(self,"_RealService")
- if s then s[k]=v end
- end
- }
- local function FakeService(t,RealService)
- t._RealService = typeof(RealService)=="string" and RealGame:GetService(RealService) or RealService
- return setmetatable(t,FakeService_Metatable)
- end
- --Fake game object
- local FakeGame = {
- GetService = function(self,s)
- return rawget(self,s) or RealGame:GetService(s)
- end,
- Players = FakeService({
- LocalPlayer = FakeService({GetMouse=function(self)return FakeMouse end},Player)
- },"Players"),
- UserInputService = FakeService(UIS,"UserInputService"),
- ContextActionService = FakeService(CAS,"ContextActionService"),
- RunService = FakeService({
- _btrs = {},
- RenderStepped = RealGame:GetService("RunService").Heartbeat,
- BindToRenderStep = function(self,name,_,fun)
- self._btrs[name] = self.Heartbeat:Connect(fun)
- end,
- UnbindFromRenderStep = function(self,name)
- self._btrs[name]:Disconnect()
- end,
- },"RunService")
- }
- rawset(FakeGame.Players,"localPlayer",FakeGame.Players.LocalPlayer)
- FakeGame.service = FakeGame.GetService
- FakeService(FakeGame,game)
- --Changing owner to fake player object to support owner:GetMouse()
- game,owner = FakeGame,FakeGame.Players.LocalPlayer
- end
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Model0 = Instance.new("Model")
- Model1 = Instance.new("Model")
- Model2 = Instance.new("Model")
- Model3 = Instance.new("Model")
- Part4 = Instance.new("Part")
- Part5 = Instance.new("Part")
- Part6 = Instance.new("Part")
- Part7 = Instance.new("Part")
- Part8 = Instance.new("Part")
- Part9 = Instance.new("Part")
- Part10 = Instance.new("Part")
- Seat11 = Instance.new("Seat")
- Part12 = Instance.new("Part")
- UnionOperation13 = Instance.new("UnionOperation")
- Model14 = Instance.new("Model")
- UnionOperation15 = Instance.new("UnionOperation")
- ObjectValue16 = Instance.new("ObjectValue")
- UnionOperation17 = Instance.new("UnionOperation")
- ObjectValue18 = Instance.new("ObjectValue")
- Part19 = Instance.new("Part")
- ObjectValue20 = Instance.new("ObjectValue")
- Part21 = Instance.new("Part")
- ObjectValue22 = Instance.new("ObjectValue")
- Part23 = Instance.new("Part")
- ObjectValue24 = Instance.new("ObjectValue")
- UnionOperation25 = Instance.new("UnionOperation")
- ObjectValue26 = Instance.new("ObjectValue")
- Model27 = Instance.new("Model")
- Part28 = Instance.new("Part")
- ObjectValue29 = Instance.new("ObjectValue")
- Part30 = Instance.new("Part")
- ObjectValue31 = Instance.new("ObjectValue")
- Part32 = Instance.new("Part")
- ObjectValue33 = Instance.new("ObjectValue")
- Part34 = Instance.new("Part")
- Sound35 = Instance.new("Sound")
- Sound36 = Instance.new("Sound")
- Sound37 = Instance.new("Sound")
- Sound38 = Instance.new("Sound")
- Sound39 = Instance.new("Sound")
- Fire40 = Instance.new("Fire")
- Smoke41 = Instance.new("Smoke")
- Sound42 = Instance.new("Sound")
- Part43 = Instance.new("Part")
- ObjectValue44 = Instance.new("ObjectValue")
- Part45 = Instance.new("Part")
- ObjectValue46 = Instance.new("ObjectValue")
- Part47 = Instance.new("Part")
- Script48 = Instance.new("Script")
- Script49 = Instance.new("Script")
- LocalScript50 = Instance.new("LocalScript")
- ObjectValue51 = Instance.new("ObjectValue")
- BoolValue52 = Instance.new("BoolValue")
- ModuleScript53 = Instance.new("ModuleScript")
- ModuleScript54 = Instance.new("ModuleScript")
- ModuleScript55 = Instance.new("ModuleScript")
- ModuleScript56 = Instance.new("ModuleScript")
- ModuleScript57 = Instance.new("ModuleScript")
- RemoteEvent58 = Instance.new("RemoteEvent")
- RemoteEvent59 = Instance.new("RemoteEvent")
- ModuleScript60 = Instance.new("ModuleScript")
- ModuleScript61 = Instance.new("ModuleScript")
- ModuleScript62 = Instance.new("ModuleScript")
- ScreenGui63 = Instance.new("ScreenGui")
- Frame64 = Instance.new("Frame")
- TextLabel65 = Instance.new("TextLabel")
- Frame66 = Instance.new("Frame")
- Frame67 = Instance.new("Frame")
- TextButton68 = Instance.new("TextButton")
- TextLabel69 = Instance.new("TextLabel")
- TextLabel70 = Instance.new("TextLabel")
- Frame71 = Instance.new("Frame")
- TextLabel72 = Instance.new("TextLabel")
- TextLabel73 = Instance.new("TextLabel")
- Frame74 = Instance.new("Frame")
- TextLabel75 = Instance.new("TextLabel")
- TextLabel76 = Instance.new("TextLabel")
- ModuleScript77 = Instance.new("ModuleScript")
- ScreenGui78 = Instance.new("ScreenGui")
- Frame79 = Instance.new("Frame")
- TextLabel80 = Instance.new("TextLabel")
- Frame81 = Instance.new("Frame")
- Frame82 = Instance.new("Frame")
- TextButton83 = Instance.new("TextButton")
- TextLabel84 = Instance.new("TextLabel")
- TextLabel85 = Instance.new("TextLabel")
- Frame86 = Instance.new("Frame")
- TextLabel87 = Instance.new("TextLabel")
- TextLabel88 = Instance.new("TextLabel")
- Frame89 = Instance.new("Frame")
- TextLabel90 = Instance.new("TextLabel")
- TextLabel91 = Instance.new("TextLabel")
- ModuleScript92 = Instance.new("ModuleScript")
- TextButton93 = Instance.new("TextButton")
- Frame94 = Instance.new("Frame")
- TextLabel95 = Instance.new("TextLabel")
- TextButton96 = Instance.new("TextButton")
- Frame97 = Instance.new("Frame")
- Frame98 = Instance.new("Frame")
- TextLabel99 = Instance.new("TextLabel")
- TextLabel100 = Instance.new("TextLabel")
- Frame101 = Instance.new("Frame")
- Frame102 = Instance.new("Frame")
- TextLabel103 = Instance.new("TextLabel")
- TextLabel104 = Instance.new("TextLabel")
- Frame105 = Instance.new("Frame")
- Frame106 = Instance.new("Frame")
- TextLabel107 = Instance.new("TextLabel")
- TextLabel108 = Instance.new("TextLabel")
- Frame109 = Instance.new("Frame")
- Frame110 = Instance.new("Frame")
- TextLabel111 = Instance.new("TextLabel")
- TextLabel112 = Instance.new("TextLabel")
- Frame113 = Instance.new("Frame")
- Frame114 = Instance.new("Frame")
- TextLabel115 = Instance.new("TextLabel")
- TextButton116 = Instance.new("TextButton")
- Frame117 = Instance.new("Frame")
- TextLabel118 = Instance.new("TextLabel")
- Frame119 = Instance.new("Frame")
- Frame120 = Instance.new("Frame")
- TextLabel121 = Instance.new("TextLabel")
- TextLabel122 = Instance.new("TextLabel")
- Frame123 = Instance.new("Frame")
- Frame124 = Instance.new("Frame")
- TextLabel125 = Instance.new("TextLabel")
- TextLabel126 = Instance.new("TextLabel")
- Frame127 = Instance.new("Frame")
- Frame128 = Instance.new("Frame")
- TextLabel129 = Instance.new("TextLabel")
- TextLabel130 = Instance.new("TextLabel")
- Frame131 = Instance.new("Frame")
- Frame132 = Instance.new("Frame")
- TextLabel133 = Instance.new("TextLabel")
- TextLabel134 = Instance.new("TextLabel")
- Frame135 = Instance.new("Frame")
- Frame136 = Instance.new("Frame")
- TextLabel137 = Instance.new("TextLabel")
- TextButton138 = Instance.new("TextButton")
- Frame139 = Instance.new("Frame")
- TextLabel140 = Instance.new("TextLabel")
- ScreenGui141 = Instance.new("ScreenGui")
- Frame142 = Instance.new("Frame")
- TextLabel143 = Instance.new("TextLabel")
- Frame144 = Instance.new("Frame")
- Frame145 = Instance.new("Frame")
- TextButton146 = Instance.new("TextButton")
- Frame147 = Instance.new("Frame")
- TextLabel148 = Instance.new("TextLabel")
- TextLabel149 = Instance.new("TextLabel")
- Frame150 = Instance.new("Frame")
- TextLabel151 = Instance.new("TextLabel")
- TextLabel152 = Instance.new("TextLabel")
- ModuleScript153 = Instance.new("ModuleScript")
- Frame154 = Instance.new("Frame")
- Frame155 = Instance.new("Frame")
- TextButton156 = Instance.new("TextButton")
- TextLabel157 = Instance.new("TextLabel")
- Frame158 = Instance.new("Frame")
- Frame159 = Instance.new("Frame")
- TextButton160 = Instance.new("TextButton")
- TextLabel161 = Instance.new("TextLabel")
- TextButton162 = Instance.new("TextButton")
- TextButton163 = Instance.new("TextButton")
- BoolValue164 = Instance.new("BoolValue")
- Script165 = Instance.new("Script")
- DoubleConstrainedValue166 = Instance.new("DoubleConstrainedValue")
- BoolValue167 = Instance.new("BoolValue")
- ModuleScript168 = Instance.new("ModuleScript")
- ModuleScript169 = Instance.new("ModuleScript")
- ModuleScript170 = Instance.new("ModuleScript")
- Model171 = Instance.new("Model")
- Model172 = Instance.new("Model")
- UnionOperation173 = Instance.new("UnionOperation")
- ObjectValue174 = Instance.new("ObjectValue")
- UnionOperation175 = Instance.new("UnionOperation")
- ObjectValue176 = Instance.new("ObjectValue")
- Part177 = Instance.new("Part")
- Part178 = Instance.new("Part")
- Model179 = Instance.new("Model")
- Part180 = Instance.new("Part")
- Part181 = Instance.new("Part")
- Part182 = Instance.new("Part")
- Part183 = Instance.new("Part")
- Part184 = Instance.new("Part")
- Part185 = Instance.new("Part")
- Part186 = Instance.new("Part")
- Part187 = Instance.new("Part")
- Part188 = Instance.new("Part")
- ObjectValue189 = Instance.new("ObjectValue")
- Part190 = Instance.new("Part")
- Model191 = Instance.new("Model")
- UnionOperation192 = Instance.new("UnionOperation")
- Part193 = Instance.new("Part")
- HingeConstraint194 = Instance.new("HingeConstraint")
- Part195 = Instance.new("Part")
- HingeConstraint196 = Instance.new("HingeConstraint")
- Model197 = Instance.new("Model")
- Part198 = Instance.new("Part")
- ObjectValue199 = Instance.new("ObjectValue")
- Part200 = Instance.new("Part")
- ObjectValue201 = Instance.new("ObjectValue")
- Part202 = Instance.new("Part")
- ObjectValue203 = Instance.new("ObjectValue")
- Part204 = Instance.new("Part")
- ObjectValue205 = Instance.new("ObjectValue")
- Part206 = Instance.new("Part")
- SurfaceGui207 = Instance.new("SurfaceGui")
- TextLabel208 = Instance.new("TextLabel")
- Script209 = Instance.new("Script")
- Script210 = Instance.new("Script")
- Model0.Name = "PlaneSystem"
- Model0.Parent = mas
- Model1.Name = "Plane"
- Model1.Parent = Model0
- Model2.Name = "Functional"
- Model2.Parent = Model1
- Model3.Name = "ControlSurfaces"
- Model3.Parent = Model2
- Part4.Name = "AileronBottomLeft"
- Part4.Parent = Model3
- Part4.CFrame = CFrame.new(-39.1004105, 5.48902893, 66.1998901, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part4.Orientation = Vector3.new(0, 180, 0)
- Part4.Position = Vector3.new(-39.1004105, 5.48902893, 66.1998901)
- Part4.Rotation = Vector3.new(180, 0, 180)
- Part4.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part4.Size = Vector3.new(6.1999979, 0.200000003, 2.39999986)
- Part4.Anchored = true
- Part4.BottomSurface = Enum.SurfaceType.Smooth
- Part4.BrickColor = BrickColor.new("Grime")
- Part4.CanCollide = false
- Part4.TopSurface = Enum.SurfaceType.Smooth
- Part4.brickColor = BrickColor.new("Grime")
- Part5.Name = "AileronBottomRight"
- Part5.Parent = Model3
- Part5.CFrame = CFrame.new(-72.8997955, 5.48902893, 66.199585, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part5.Orientation = Vector3.new(0, 180, 0)
- Part5.Position = Vector3.new(-72.8997955, 5.48902893, 66.199585)
- Part5.Rotation = Vector3.new(180, 0, 180)
- Part5.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part5.Size = Vector3.new(6.1999979, 0.200000003, 2.39999986)
- Part5.Anchored = true
- Part5.BottomSurface = Enum.SurfaceType.Smooth
- Part5.BrickColor = BrickColor.new("Grime")
- Part5.CanCollide = false
- Part5.TopSurface = Enum.SurfaceType.Smooth
- Part5.brickColor = BrickColor.new("Grime")
- Part6.Name = "AileronTopLeft"
- Part6.Parent = Model3
- Part6.CFrame = CFrame.new(-39.2004013, 11.4888668, 64.3999023, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part6.Orientation = Vector3.new(0, 180, 0)
- Part6.Position = Vector3.new(-39.2004013, 11.4888668, 64.3999023)
- Part6.Rotation = Vector3.new(180, 0, 180)
- Part6.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part6.Size = Vector3.new(6.39999771, 0.200000003, 2.39999986)
- Part6.Anchored = true
- Part6.BottomSurface = Enum.SurfaceType.Smooth
- Part6.BrickColor = BrickColor.new("Grime")
- Part6.CanCollide = false
- Part6.TopSurface = Enum.SurfaceType.Smooth
- Part6.brickColor = BrickColor.new("Grime")
- Part7.Name = "AileronTopRight"
- Part7.Parent = Model3
- Part7.CFrame = CFrame.new(-72.7997284, 11.4888706, 64.3999634, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part7.Orientation = Vector3.new(0, 180, 0)
- Part7.Position = Vector3.new(-72.7997284, 11.4888706, 64.3999634)
- Part7.Rotation = Vector3.new(180, 0, 180)
- Part7.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part7.Size = Vector3.new(6.39999771, 0.200000003, 2.39999986)
- Part7.Anchored = true
- Part7.BottomSurface = Enum.SurfaceType.Smooth
- Part7.BrickColor = BrickColor.new("Grime")
- Part7.CanCollide = false
- Part7.TopSurface = Enum.SurfaceType.Smooth
- Part7.brickColor = BrickColor.new("Grime")
- Part8.Name = "ElevatorLeft"
- Part8.Parent = Model3
- Part8.CFrame = CFrame.new(-53.2001152, 6.98896503, 45.7995605, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part8.Orientation = Vector3.new(0, 180, 0)
- Part8.Position = Vector3.new(-53.2001152, 6.98896503, 45.7995605)
- Part8.Rotation = Vector3.new(180, 0, 180)
- Part8.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part8.Size = Vector3.new(4.5999999, 0.200000003, 2)
- Part8.Anchored = true
- Part8.BottomSurface = Enum.SurfaceType.Smooth
- Part8.BrickColor = BrickColor.new("Grime")
- Part8.TopSurface = Enum.SurfaceType.Smooth
- Part8.brickColor = BrickColor.new("Grime")
- Part9.Name = "ElevatorRight"
- Part9.Parent = Model3
- Part9.CFrame = CFrame.new(-58.8000603, 6.98896408, 45.7997437, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part9.Orientation = Vector3.new(0, 180, 0)
- Part9.Position = Vector3.new(-58.8000603, 6.98896408, 45.7997437)
- Part9.Rotation = Vector3.new(180, 0, 180)
- Part9.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part9.Size = Vector3.new(4.5999999, 0.200000003, 2)
- Part9.Anchored = true
- Part9.BottomSurface = Enum.SurfaceType.Smooth
- Part9.BrickColor = BrickColor.new("Grime")
- Part9.TopSurface = Enum.SurfaceType.Smooth
- Part9.brickColor = BrickColor.new("Grime")
- Part10.Name = "Rudder"
- Part10.Parent = Model3
- Part10.CFrame = CFrame.new(-56.0001335, 8.48893166, 45.199585, -1.67546896e-05, 1.00000048, 3.51518673e-20, 1.00000012, 1.67547405e-05, -4.65661287e-10, 4.65661287e-10, 3.90105217e-15, -1)
- Part10.Orientation = Vector3.new(0, 180, 90)
- Part10.Position = Vector3.new(-56.0001335, 8.48893166, 45.199585)
- Part10.Rotation = Vector3.new(180, 0, -90)
- Part10.Color = Color3.new(0.639216, 0.294118, 0.294118)
- Part10.Size = Vector3.new(3.20000005, 0.200000003, 2)
- Part10.Anchored = true
- Part10.BottomSurface = Enum.SurfaceType.Smooth
- Part10.BrickColor = BrickColor.new("Dusty Rose")
- Part10.TopSurface = Enum.SurfaceType.Smooth
- Part10.brickColor = BrickColor.new("Dusty Rose")
- Seat11.Name = "PilotSeat"
- Seat11.Parent = Model2
- Seat11.CFrame = CFrame.new(-56.0000725, 6.68897247, 66.1999512, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Seat11.Orientation = Vector3.new(0, 180, 0)
- Seat11.Position = Vector3.new(-56.0000725, 6.68897247, 66.1999512)
- Seat11.Rotation = Vector3.new(180, 0, 180)
- Seat11.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Seat11.Size = Vector3.new(2, 0.600000024, 2)
- Seat11.Disabled = true
- Seat11.Anchored = true
- Seat11.BottomSurface = Enum.SurfaceType.Smooth
- Seat11.BrickColor = BrickColor.new("Institutional white")
- Seat11.Material = Enum.Material.Fabric
- Seat11.TopSurface = Enum.SurfaceType.Smooth
- Seat11.brickColor = BrickColor.new("Institutional white")
- Part12.Name = "Joystick"
- Part12.Parent = Model2
- Part12.CFrame = CFrame.new(-56.0001335, 7.38897705, 67.4998169, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part12.Orientation = Vector3.new(0, 180, 0)
- Part12.Position = Vector3.new(-56.0001335, 7.38897705, 67.4998169)
- Part12.Rotation = Vector3.new(180, 0, 180)
- Part12.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part12.Size = Vector3.new(0.200000003, 2, 0.200000003)
- Part12.Anchored = true
- Part12.BottomSurface = Enum.SurfaceType.Smooth
- Part12.BrickColor = BrickColor.new("Brown")
- Part12.Material = Enum.Material.Wood
- Part12.TopSurface = Enum.SurfaceType.Smooth
- Part12.brickColor = BrickColor.new("Brown")
- UnionOperation13.Name = "Propeller"
- UnionOperation13.Parent = Model2
- UnionOperation13.CFrame = CFrame.new(-55.9999962, 7.38897514, 72.5, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- UnionOperation13.Orientation = Vector3.new(0, 180, 0)
- UnionOperation13.Position = Vector3.new(-55.9999962, 7.38897514, 72.5)
- UnionOperation13.Rotation = Vector3.new(180, 0, 180)
- UnionOperation13.Color = Color3.new(0.486275, 0.360784, 0.27451)
- UnionOperation13.Size = Vector3.new(12, 1.00000215, 1)
- UnionOperation13.Anchored = true
- UnionOperation13.BrickColor = BrickColor.new("Brown")
- UnionOperation13.CanCollide = false
- UnionOperation13.Material = Enum.Material.Wood
- UnionOperation13.brickColor = BrickColor.new("Brown")
- UnionOperation13.UsePartColor = true
- Model14.Name = "StaticAirFoils"
- Model14.Parent = Model2
- UnionOperation15.Name = "WingBottomRight"
- UnionOperation15.Parent = Model14
- UnionOperation15.CFrame = CFrame.new(-66.9998474, 5.48902512, 68.000061, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- UnionOperation15.Orientation = Vector3.new(0, 180, 0)
- UnionOperation15.Position = Vector3.new(-66.9998474, 5.48902512, 68.000061)
- UnionOperation15.Rotation = Vector3.new(180, 0, 180)
- UnionOperation15.Color = Color3.new(0.498039, 0.556863, 0.392157)
- UnionOperation15.Size = Vector3.new(18, 0.20000416, 6)
- UnionOperation15.Anchored = true
- UnionOperation15.BrickColor = BrickColor.new("Grime")
- UnionOperation15.brickColor = BrickColor.new("Grime")
- UnionOperation15.UsePartColor = true
- ObjectValue16.Name = "DamageCollider"
- ObjectValue16.Parent = UnionOperation15
- UnionOperation17.Name = "WingBottomLeft"
- UnionOperation17.Parent = Model14
- UnionOperation17.CFrame = CFrame.new(-45.0000725, 5.48903084, 67.9997559, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- UnionOperation17.Orientation = Vector3.new(0, 180, 0)
- UnionOperation17.Position = Vector3.new(-45.0000725, 5.48903084, 67.9997559)
- UnionOperation17.Rotation = Vector3.new(180, 0, 180)
- UnionOperation17.Color = Color3.new(0.498039, 0.556863, 0.392157)
- UnionOperation17.Size = Vector3.new(18.0000019, 0.200001583, 6.00000191)
- UnionOperation17.Anchored = true
- UnionOperation17.BrickColor = BrickColor.new("Grime")
- UnionOperation17.brickColor = BrickColor.new("Grime")
- UnionOperation17.UsePartColor = true
- ObjectValue18.Name = "DamageCollider"
- ObjectValue18.Parent = UnionOperation17
- Part19.Name = "HorizontalStabilizerLeft"
- Part19.Parent = Model14
- Part19.CFrame = CFrame.new(-53.3999443, 6.9889698, 47.7996216, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part19.Orientation = Vector3.new(0, 180, 0)
- Part19.Position = Vector3.new(-53.3999443, 6.9889698, 47.7996216)
- Part19.Rotation = Vector3.new(180, 0, 180)
- Part19.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part19.Size = Vector3.new(5, 0.200000003, 2)
- Part19.Anchored = true
- Part19.BottomSurface = Enum.SurfaceType.Smooth
- Part19.BrickColor = BrickColor.new("Grime")
- Part19.TopSurface = Enum.SurfaceType.Smooth
- Part19.brickColor = BrickColor.new("Grime")
- ObjectValue20.Name = "DamageCollider"
- ObjectValue20.Parent = Part19
- Part21.Name = "HorizontalStabilizerRight"
- Part21.Parent = Model14
- Part21.CFrame = CFrame.new(-58.6000481, 6.9889698, 47.7997437, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part21.Orientation = Vector3.new(0, 180, 0)
- Part21.Position = Vector3.new(-58.6000481, 6.9889698, 47.7997437)
- Part21.Rotation = Vector3.new(180, 0, 180)
- Part21.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part21.Size = Vector3.new(5, 0.200000003, 2)
- Part21.Anchored = true
- Part21.BottomSurface = Enum.SurfaceType.Smooth
- Part21.BrickColor = BrickColor.new("Grime")
- Part21.TopSurface = Enum.SurfaceType.Smooth
- Part21.brickColor = BrickColor.new("Grime")
- ObjectValue22.Name = "DamageCollider"
- ObjectValue22.Parent = Part21
- Part23.Name = "VerticalStabilizer"
- Part23.Parent = Model14
- Part23.CFrame = CFrame.new(-56.0002556, 9.38890362, 47.1998901, -1.67546896e-05, 1.00000048, 3.51518673e-20, 1.00000012, 1.67547405e-05, -4.65661287e-10, 4.65661287e-10, 3.90105217e-15, -1)
- Part23.Orientation = Vector3.new(0, 180, 90)
- Part23.Position = Vector3.new(-56.0002556, 9.38890362, 47.1998901)
- Part23.Rotation = Vector3.new(180, 0, -90)
- Part23.Color = Color3.new(0.0156863, 0.686275, 0.92549)
- Part23.Size = Vector3.new(3, 0.200000003, 2)
- Part23.Anchored = true
- Part23.BottomSurface = Enum.SurfaceType.Smooth
- Part23.BrickColor = BrickColor.new("Cyan")
- Part23.TopSurface = Enum.SurfaceType.Smooth
- Part23.brickColor = BrickColor.new("Cyan")
- ObjectValue24.Name = "DamageCollider"
- ObjectValue24.Parent = Part23
- UnionOperation25.Name = "WingTop"
- UnionOperation25.Parent = Model14
- UnionOperation25.CFrame = CFrame.new(-56.000164, 11.4888725, 66.1998291, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- UnionOperation25.Orientation = Vector3.new(0, 180, 0)
- UnionOperation25.Position = Vector3.new(-56.000164, 11.4888725, 66.1998291)
- UnionOperation25.Rotation = Vector3.new(180, 0, 180)
- UnionOperation25.Color = Color3.new(0.498039, 0.556863, 0.392157)
- UnionOperation25.Size = Vector3.new(40, 0.200006351, 6.00000095)
- UnionOperation25.Anchored = true
- UnionOperation25.BrickColor = BrickColor.new("Grime")
- UnionOperation25.brickColor = BrickColor.new("Grime")
- UnionOperation25.UsePartColor = true
- ObjectValue26.Name = "DamageCollider"
- ObjectValue26.Parent = UnionOperation25
- Model27.Name = "Engine"
- Model27.Parent = Model2
- Part28.Name = "EnginePart"
- Part28.Parent = Model27
- Part28.CFrame = CFrame.new(-57.6998863, 7.38896847, 71.2999268, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part28.Orientation = Vector3.new(0, 180, 0)
- Part28.Position = Vector3.new(-57.6998863, 7.38896847, 71.2999268)
- Part28.Rotation = Vector3.new(180, 0, 180)
- Part28.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part28.Size = Vector3.new(0.599999905, 4, 1.80000007)
- Part28.Anchored = true
- Part28.BottomSurface = Enum.SurfaceType.Smooth
- Part28.BrickColor = BrickColor.new("Mid gray")
- Part28.Material = Enum.Material.SmoothPlastic
- Part28.Reflectance = 0.30000001192093
- Part28.TopSurface = Enum.SurfaceType.Smooth
- Part28.brickColor = BrickColor.new("Mid gray")
- ObjectValue29.Name = "DamageCollider"
- ObjectValue29.Parent = Part28
- Part30.Name = "EnginePart"
- Part30.Parent = Model27
- Part30.CFrame = CFrame.new(-56.000164, 9.08894634, 71.2999268, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part30.Orientation = Vector3.new(0, 180, 0)
- Part30.Position = Vector3.new(-56.000164, 9.08894634, 71.2999268)
- Part30.Rotation = Vector3.new(180, 0, 180)
- Part30.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part30.Size = Vector3.new(2.79999995, 0.600000024, 1.80000007)
- Part30.Anchored = true
- Part30.BottomSurface = Enum.SurfaceType.Smooth
- Part30.BrickColor = BrickColor.new("Mid gray")
- Part30.Material = Enum.Material.SmoothPlastic
- Part30.Reflectance = 0.30000001192093
- Part30.TopSurface = Enum.SurfaceType.Smooth
- Part30.brickColor = BrickColor.new("Mid gray")
- ObjectValue31.Name = "DamageCollider"
- ObjectValue31.Parent = Part30
- Part32.Name = "EnginePart"
- Part32.Parent = Model27
- Part32.CFrame = CFrame.new(-56.0000572, 5.68899727, 71.2999268, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part32.Orientation = Vector3.new(0, 180, 0)
- Part32.Position = Vector3.new(-56.0000572, 5.68899727, 71.2999268)
- Part32.Rotation = Vector3.new(180, 0, 180)
- Part32.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part32.Size = Vector3.new(2.79999995, 0.600000024, 1.80000007)
- Part32.Anchored = true
- Part32.BottomSurface = Enum.SurfaceType.Smooth
- Part32.BrickColor = BrickColor.new("Mid gray")
- Part32.Material = Enum.Material.SmoothPlastic
- Part32.Reflectance = 0.30000001192093
- Part32.TopSurface = Enum.SurfaceType.Smooth
- Part32.brickColor = BrickColor.new("Mid gray")
- ObjectValue33.Name = "DamageCollider"
- ObjectValue33.Parent = Part32
- Part34.Name = "EngineMain"
- Part34.Parent = Model27
- Part34.CFrame = CFrame.new(-56.0001183, 7.38898087, 71.6998291, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part34.Orientation = Vector3.new(0, 180, 0)
- Part34.Position = Vector3.new(-56.0001183, 7.38898087, 71.6998291)
- Part34.Rotation = Vector3.new(180, 0, 180)
- Part34.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part34.Size = Vector3.new(2.79999995, 2.80000019, 0.600000024)
- Part34.Anchored = true
- Part34.BottomSurface = Enum.SurfaceType.Smooth
- Part34.BrickColor = BrickColor.new("Mid gray")
- Part34.Material = Enum.Material.SmoothPlastic
- Part34.Reflectance = 0.30000001192093
- Part34.TopSurface = Enum.SurfaceType.Smooth
- Part34.brickColor = BrickColor.new("Mid gray")
- Sound35.Name = "Shutdown"
- Sound35.Parent = Part34
- Sound35.EmitterSize = 30
- Sound35.MinDistance = 30
- Sound35.SoundId = "rbxassetid://133922235"
- Sound36.Name = "Startup"
- Sound36.Parent = Part34
- Sound36.EmitterSize = 30
- Sound36.MinDistance = 30
- Sound36.SoundId = "rbxassetid://133859905"
- Sound37.Name = "Idle"
- Sound37.Parent = Part34
- Sound37.Looped = true
- Sound37.EmitterSize = 30
- Sound37.MinDistance = 30
- Sound37.SoundId = "rbxassetid://618990950"
- Sound38.Name = "LowThrottle"
- Sound38.Parent = Part34
- Sound38.Looped = true
- Sound38.EmitterSize = 30
- Sound38.MinDistance = 30
- Sound38.SoundId = "rbxassetid://618991005"
- Sound39.Name = "Flying"
- Sound39.Parent = Part34
- Sound39.Looped = true
- Sound39.EmitterSize = 30
- Sound39.MinDistance = 30
- Sound39.SoundId = "rbxassetid://618991252"
- Fire40.Parent = Part34
- Fire40.Enabled = false
- Fire40.Size = 20
- Fire40.Heat = 25
- Fire40.size = 20
- Smoke41.Parent = Part34
- Smoke41.Color = Color3.new(0.384314, 0.384314, 0.384314)
- Smoke41.Enabled = false
- Smoke41.Size = 10
- Smoke41.RiseVelocity = 10
- Sound42.Name = "Explosion"
- Sound42.Parent = Part34
- Sound42.EmitterSize = 40
- Sound42.MinDistance = 40
- Sound42.SoundId = "rbxassetid://413503439"
- Sound42.Volume = 1
- Part43.Name = "EnginePart"
- Part43.Parent = Model27
- Part43.CFrame = CFrame.new(-54.2999687, 7.38897419, 71.2998047, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part43.Orientation = Vector3.new(0, 180, 0)
- Part43.Position = Vector3.new(-54.2999687, 7.38897419, 71.2998047)
- Part43.Rotation = Vector3.new(180, 0, 180)
- Part43.Color = Color3.new(0.803922, 0.803922, 0.803922)
- Part43.Size = Vector3.new(0.599999905, 4, 1.80000007)
- Part43.Anchored = true
- Part43.BottomSurface = Enum.SurfaceType.Smooth
- Part43.BrickColor = BrickColor.new("Mid gray")
- Part43.Material = Enum.Material.SmoothPlastic
- Part43.Reflectance = 0.30000001192093
- Part43.TopSurface = Enum.SurfaceType.Smooth
- Part43.brickColor = BrickColor.new("Mid gray")
- ObjectValue44.Name = "DamageCollider"
- ObjectValue44.Parent = Part43
- Part45.Name = "Nose"
- Part45.Parent = Model27
- Part45.CFrame = CFrame.new(-55.9999962, 7.38897514, 72.5, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part45.Orientation = Vector3.new(0, 180, 0)
- Part45.Position = Vector3.new(-55.9999962, 7.38897514, 72.5)
- Part45.Rotation = Vector3.new(180, 0, 180)
- Part45.Transparency = 1
- Part45.Size = Vector3.new(2, 2, 2)
- Part45.Anchored = true
- Part45.BottomSurface = Enum.SurfaceType.Smooth
- Part45.TopSurface = Enum.SurfaceType.Smooth
- Part45.Shape = Enum.PartType.Ball
- ObjectValue46.Name = "DamageCollider"
- ObjectValue46.Parent = Part45
- Part47.Name = "TailSkid"
- Part47.Parent = Model2
- Part47.CFrame = CFrame.new(-55.9998741, 5.96219826, 48.9996948, -1.00000048, 3.34913375e-10, 8.55832738e-10, 3.01952296e-10, 0.866017938, 0.500013113, 3.51518673e-20, 0.500013173, -0.866017938)
- Part47.Orientation = Vector3.new(-30, 180, 0)
- Part47.Position = Vector3.new(-55.9998741, 5.96219826, 48.9996948)
- Part47.Rotation = Vector3.new(-150, 0, -180)
- Part47.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part47.Size = Vector3.new(0.200000003, 2.60000014, 0.200000003)
- Part47.Anchored = true
- Part47.BottomSurface = Enum.SurfaceType.Smooth
- Part47.BrickColor = BrickColor.new("Brown")
- Part47.Material = Enum.Material.Wood
- Part47.TopSurface = Enum.SurfaceType.Smooth
- Part47.brickColor = BrickColor.new("Brown")
- Script48.Name = "Welder"
- Script48.Parent = Model1
- table.insert(cors,sandbox(Script48,function()
- -- Welder
- -- Crazyman32
- -- January 18, 2017
- --[[
- Welds the plane together! Also creates special welds
- for animations, which are designated by Attachment
- objects named "AnimatedAttchment" within parts.
- Animations are done with a bit of trickery. Since I
- want to simply rotate the welds in order to rotate
- surface control parts, I came up with a design that
- creates two "joint" parts at the location of the
- AnimatedAttachment object. One of the joints is
- auto-welded to the primary part of the plane. The
- other joint is welded directly to the first joint.
- This second joint will contain the "animate" weld
- object that can simply be rotated to move the surface.
- Finally, the control surface itself is auto-welded
- to the second joint, so that moving the second joint
- will move the control surface.
- To break that paragraph down in steps:
- 1. Create 2 "joint" parts (J1 and J2), both at the location of AnimatedAttachment
- 2. Auto-weld J1 to the plane
- 3. Weld J2 directly to J1
- 4. Auto-weld the control surface to J2
- 5. Use the J2 weld to animate the control surface by setting it's C0 cframe property
- --]]
- local plane = script.Parent
- local readyToWeld = plane:WaitForChild("ReadyToWeld")
- while (not readyToWeld.Value) do wait() end
- readyToWeld:Destroy()
- readyToWeld = nil
- -- Don't weld any parts that have the following names in ignore table:
- local ignore = {
- -- Ignore the wheels because they use physics Hinges instead of welds:
- ["WheelLeft"] = true;
- ["WheelRight"] = true;
- }
- -- Set the "EngineMain" part as the PrimaryPart of the model: (super important for almost every other script in the system)
- local main = plane:WaitForChild("Functional"):WaitForChild("Engine"):WaitForChild("EngineMain")
- plane.PrimaryPart = main
- -- Putting all the welds into this folder:
- local welds = Instance.new("Folder", plane)
- welds.Name = "Welds"
- -- Putting all the animated welds into this folder:
- local animWelds = Instance.new("Folder", welds)
- animWelds.Name = "AnimatedWelds"
- -- Putting all the joints into this model:
- local joints = Instance.new("Model", plane)
- joints.Name = "Joints"
- -- Our Joint "prefab":
- local joint = Instance.new("Part")
- joint.Name = "Joint"
- joint.Anchored = true
- joint.CanCollide = false
- joint.Locked = true
- joint.Material = Enum.Material.SmoothPlastic
- joint.TopSurface = Enum.SurfaceType.Smooth
- joint.BottomSurface = Enum.SurfaceType.Smooth
- joint.Transparency = 1
- joint.Size = Vector3.new(0.4, 0.4, 0.4)
- -- Autoweld 'p0' to 'p1':
- function AutoWeldTo(p0, p1)
- -- See ROBLOX Wiki page to understand how this works:
- -- http://wiki.roblox.com/index.php?title=Weld#Welding_together_two_existing_bricks
- local w = Instance.new("Weld", welds)
- w.Name = "PlaneWeld"
- w.Part0, w.Part1 = p0, p1
- w.C0 = p0.CFrame:inverse() * p1.CFrame
- end
- -- Auto-weld the given part to the 'main' part of the plane:
- function AutoWeld(part)
- AutoWeldTo(part, main)
- end
- -- Weld all descendants of 'parent':
- function Weld(parent)
- if (parent == joints) then return end
- for _,child in pairs(parent:GetChildren()) do
- if (child:IsA("BasePart") and child ~= main) then
- local attachment = child:FindFirstChild("AnimatedAttachment")
- -- Weld animated parts:
- if (attachment) then
- local offset = attachment.Position
- -- Joint1:
- local j1 = joint:Clone()
- j1.Parent = joints
- -- Sorry, this is gross! It places the joint at the position of the attachment:
- j1.CFrame = child.CFrame * CFrame.new(offset.X, offset.Y, offset.Z) * CFrame.Angles(math.rad(attachment.Rotation.X), math.rad(attachment.Rotation.Y), math.rad(attachment.Rotation.Z))
- -- Joint2:
- local j2 = j1:Clone()
- j2.Parent = joints
- -- The animated weld:
- local animWeld = Instance.new("Weld", animWelds)
- animWeld.Name = child.Name
- animWeld.Part0, animWeld.Part1 = j1, j2
- AutoWeldTo(child, j2)
- AutoWeld(j1)
- j1.Anchored = false
- j2.Anchored = false
- attachment:Destroy()
- -- Weld non-ignored and non-animated parts directly to the plane:
- elseif (not ignore[child.Name]) then
- AutoWeld(child)
- end
- child.Anchored = false
- end
- Weld(child)
- end
- end
- Weld(plane)
- main.Anchored = false
- -- Mark as ready, so that the Controller script knows the plane is welded:
- local welded = Instance.new("ObjectValue")
- welded.Name = "Welded"
- welded.Parent = plane
- end))
- Script49.Name = "Controller"
- Script49.Parent = Model1
- table.insert(cors,sandbox(Script49,function()
- -- Controller
- -- Crazyman32
- -- January 18, 2017
- --[[
- This script has 2 primary purposes:
- 1) Handle players entering/leaving the pilot seat
- 2) Run flight physics if no player is present
- When a player is flying the plane, the player's client
- handles the physics calculations. When the player leaves,
- the calculations need to be delegated back to the server,
- hence the 2nd purpose listed.
- e.g. If the player is flying the plane and then leaves
- the server, this script will pick up the physics
- and properly continue to simulate the aircraft.
- --]]
- local plane = script.Parent
- -- Wait for plane to be welded:
- plane:WaitForChild("Welded"):Destroy()
- local main = plane.PrimaryPart
- -- This is what powers the aircraft & is used by the Flyer module:
- local attachment = Instance.new("Attachment",main)
- local vector_force = Instance.new("VectorForce",main)
- vector_force.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
- vector_force.Attachment0 = attachment
- local functional = plane:WaitForChild("Functional")
- local seat = functional:WaitForChild("PilotSeat")
- local flyer = require(plane:WaitForChild("Flyer"))
- local localController = script:WaitForChild("LocalController")
- local dead = plane:WaitForChild("Dead")
- local pilot = nil
- local pilotController = nil
- local updateHandler
- function SetNetworkOwner(player)
- local function Scan(parent)
- for _,v in pairs(parent:GetChildren()) do
- if (v:IsA("BasePart")) then
- v:SetNetworkOwner(player)
- end
- Scan(v)
- end
- end
- Scan(plane)
- end
- -- Server-side plane physics updates:
- function Update()
- flyer:Update()
- --[[
- if (not dead.Value) then
- flyer:UpdateControls()
- end
- ]]
- end
- function UpdateControls()
- if (not dead.Value) then
- flyer:UpdateControls()
- end
- end
- -- Reset flyer inputs:
- function ResetFlyer()
- flyer.Throttle = 0
- flyer.BankInput = 0
- flyer.PitchInput = 0
- flyer.YawInput = 0
- end
- -- Start server-side plane updates:
- function StartUpdating()
- if (updateHandler) then return end
- updateHandler = game:GetService("RunService").Heartbeat:Connect(Update)
- end
- -- Stop server-side plane updates:
- function StopUpdating()
- if (updateHandler) then
- updateHandler:Disconnect()
- updateHandler = nil
- end
- ResetFlyer()
- end
- function PilotExitedEvent(player, t, b, p, y)
- flyer.BankInput = b
- flyer.PitchInput = p
- flyer.YawInput = y
- flyer:ForceRealThrottle(t)
- if (t <= 0.52) then
- flyer.Throttle = 0
- end
- end
- function PilotUpdatedEvent(player, name, ...)
- if (name == "inputs") then
- local inputs = {...}
- flyer.Throttle = inputs[1]
- flyer.BankInput = inputs[2]
- flyer.PitchInput = inputs[3]
- flyer.YawInput = inputs[4]
- end
- end
- -- Handle when a player enters the pilot seat:
- function PilotEntered(player)
- -- Delegate flight controls to the new pilot:
- StopUpdating()
- SetNetworkOwner(player)
- pilot = player
- pilotController = localController:Clone()
- pilotController.Parent = pilot.Backpack
- pilotController:WaitForChild("Plane").Value = plane
- pilotController:WaitForChild("Exited").OnServerEvent:Connect(PilotExitedEvent)
- pilotController:WaitForChild("Updated").OnServerEvent:Connect(PilotUpdatedEvent)
- end
- -- Handle when the pilot leaves the seat:
- function PilotLeft(onPlaneDeath)
- if (not pilot) then return end
- if (not onPlaneDeath) then
- seat.Disabled = true
- end
- -- Tell the client script to stop:
- pilotController.Exit.Value = true
- pilot = nil
- StartUpdating()
- -- Remove network ownership from the player:
- if (not onPlaneDeath) then
- SetNetworkOwner(nil)
- end
- delay(1, function()
- if (pilotController.Parent) then
- pilotController:Destroy()
- end
- pilotController = nil
- if (not seat.Occupant or not dead.Value) then
- seat.Disabled = false
- end
- end)
- end
- -- Track player entering/leaving pilot seat:
- function SeatChanged(property)
- if (property == "Occupant") then
- local humanoid = seat.Occupant
- if (humanoid) then
- local player = game.Players:GetPlayerFromCharacter(humanoid.Parent)
- if (player and not dead.Value) then
- PilotEntered(player)
- end
- else
- PilotLeft()
- end
- end
- end
- dead.Changed:Connect(function(v)
- if (v and pilot) then
- PilotLeft(true)
- end
- end)
- seat.Changed:Connect(SeatChanged)
- seat.Disabled = false
- StartUpdating()
- game:GetService("RunService").Heartbeat:Connect(UpdateControls)
- end))
- LocalScript50.Name = "LocalController"
- LocalScript50.Parent = Script49
- table.insert(cors,sandbox(LocalScript50,function()
- -- Local Controller
- -- Crazyman32
- -- January 18, 2017
- --[[
- This script is given to the pilot of the plane and
- feeds user input to the Flyer module. The Flyer
- module is what is responsible for doing the actual
- heavy work of flying the plane.
- It can dynamically change the type of input used
- to control the plane. The supported controls are
- Keyboard, Mouse+Keyboard, Gamepad, and Mobile.
- --]]
- local IS_CONSOLE = game:GetService("GuiService"):IsTenFootInterface()
- local IS_MOBILE = game:GetService("UserInputService").TouchEnabled and not game:GetService("UserInputService").MouseEnabled and not IS_CONSOLE
- local modal
- local GAMEPAD_DEADZONE = 0.1
- local PI = math.pi
- local ABS = math.abs
- -- Seconds between client sending server input updates:
- local SERVER_UPDATE_INTERVAL = 0.25
- -- Inputs:
- local KEY_W = Enum.KeyCode.W
- local KEY_A = Enum.KeyCode.A
- local KEY_S = Enum.KeyCode.S
- local KEY_D = Enum.KeyCode.D
- local KEY_Q = Enum.KeyCode.Q
- local KEY_E = Enum.KeyCode.E
- local KEY_Z = Enum.KeyCode.Z
- local KEY_X = Enum.KeyCode.X
- local THUMBSTICK_1 = Enum.KeyCode.Thumbstick1
- local THUMBSTICK_2 = Enum.KeyCode.Thumbstick2
- local BUTTON_RB = Enum.KeyCode.ButtonR1
- local BUTTON_RT = Enum.KeyCode.ButtonR2
- local BUTTON_LB = Enum.KeyCode.ButtonL1
- local BUTTON_LT = Enum.KeyCode.ButtonL2
- local MOUSE_BUTTON_2 = Enum.UserInputType.MouseButton2
- local player = game.Players.LocalPlayer
- local plane = script:WaitForChild("Plane")
- while (not plane.Value) do wait() end
- plane = plane.Value
- script.Plane:Destroy()
- local main = plane.PrimaryPart
- local exit = script:WaitForChild("Exit")
- local updated = script:WaitForChild("Updated")
- local flyer = require(plane:WaitForChild("Flyer"))
- local camLock = require(script:WaitForChild("CamLock"))
- local controls = require(script:WaitForChild("Controls"))
- local keyboard = controls.Keyboard
- local mouse = controls.Mouse
- local gamepad = controls.Gamepad
- local mobile = controls.Mobile
- local physicsUpdateHandle
- local renderUpdateName = "PlaneRenderUpdate"
- local lastServerUpdate = 0
- local lastInputUpdate = tick()
- -- Dynamic input function based on user's controls:
- local ReadInput = nil
- -- Keep track of viewport half-size:
- local viewportHalf = game.Workspace.CurrentCamera.ViewportSize * 0.5
- game.Workspace.CurrentCamera.Changed:Connect(function()
- viewportHalf = game.Workspace.CurrentCamera.ViewportSize * 0.5
- end)
- -- Load proper GUI:
- local gui = script:WaitForChild(IS_MOBILE and "PlaneMobileGui" or IS_CONSOLE and "PlaneConsoleGui" or "PlaneGui")
- gui.Parent = player.PlayerGui
- local guiController = require(gui:WaitForChild("GuiController"))
- -- Apply Gamepad Deadzone:
- local function ApplyDeadzone(n)
- if (ABS(n) < GAMEPAD_DEADZONE) then return 0 end
- return (n + (n > 0 and -GAMEPAD_DEADZONE or GAMEPAD_DEADZONE)) / (1 - GAMEPAD_DEADZONE)
- end
- -- Gamepad Input:
- local function ReadGamepadInput(dt)
- -- Get delta time:
- local now = tick()
- local dt = (now - lastInputUpdate)
- lastInputUpdate = now
- -- Get gamepad inputs:
- local thumbstick1 = gamepad:GetPosition(THUMBSTICK_1)
- local thumbstick2 = gamepad:GetPosition(THUMBSTICK_2)
- local lt = ApplyDeadzone(gamepad:GetPosition(BUTTON_LT).Z)
- local rt = ApplyDeadzone(gamepad:GetPosition(BUTTON_RT).Z)
- local lb = gamepad:IsDown(BUTTON_LB)
- local rb = gamepad:IsDown(BUTTON_RB)
- -- Update control inputs:
- flyer.BankInput = ApplyDeadzone(thumbstick2.X)
- flyer.PitchInput = ApplyDeadzone(thumbstick2.Y)
- flyer.YawInput = ((lb ~= rb) and (lb and -1 or 1) or 0)
- do
- local dir = -lt + rt
- local t = flyer.Throttle + (dir * dt * 0.2)
- t = (t < 0.5 and 0.5 or t > 1 and 1 or t)
- flyer.Throttle = t
- guiController:UpdateThrottle(t)
- end
- -- Set camera rotation:
- camLock.SetRotation(
- -ApplyDeadzone(thumbstick1.X) * PI * 0.9,
- ApplyDeadzone(thumbstick1.Y) * PI * 0.45
- )
- end
- -- Mobile Input:
- local function ReadMobileInput()
- -- Poll to see if user wants to switch view:
- if (guiController.SwitchView) then
- guiController.SwitchView = false
- camLock.SwitchView()
- end
- -- Update control inputs:
- flyer.BankInput = guiController.Bank
- flyer.PitchInput = -guiController.Pitch
- flyer.YawInput = guiController.Yaw
- flyer.Throttle = 0.5 + (guiController.Throttle * 0.5)
- -- Set camera rotation:
- camLock.SetMobileDeviceBank(mobile.DeviceBank)
- camLock.SetRotation(
- -guiController.ViewX * PI * 0.9,
- guiController.ViewY * PI * 0.45
- )
- -- Poll to see if player wants to exit the plane:
- if (guiController.Exit) then
- if (player.Character and player.Character:FindFirstChild("Humanoid")) then
- player.Character.Humanoid.Jump = true
- end
- end
- end
- -- Keyboard and Mouse Input:
- local function ReadKeyboardAndMouseInput()
- -- Get delta time:
- local now = tick()
- local dt = (now - lastInputUpdate)
- lastInputUpdate = now
- -- Declare & initialize new control inputs:
- local bank, pitch, yaw, throttle = 0, 0, 0, 0
- -- Mouse yoke:
- if (guiController.UseMouse) then
- -- Mouse and key inputs:
- local mx = mouse.X
- local my = mouse.Y
- local w = keyboard:IsDown(KEY_W)
- local a = keyboard:IsDown(KEY_A)
- local s = keyboard:IsDown(KEY_S)
- local d = keyboard:IsDown(KEY_D)
- if (not mouse:IsDown(MOUSE_BUTTON_2)) then
- -- Update bank and pitch based on mouse position on screen:
- bank = (mx - viewportHalf.X) / viewportHalf.X
- pitch = (my - viewportHalf.Y) / viewportHalf.Y
- --[[ UNCOMMENT this block to lock bank/pitch in last position when looking around:
- else
- bank = flyer.BankInput
- pitch = flyer.PitchInput
- ]]
- end
- -- Update yaw and throttle:
- yaw = ((a ~= d) and (d and 1 or -1) or 0)
- throttle = ((w ~= s) and (w and 1 or -1) or 0)
- -- Keyboard yoke:
- else
- -- This is the prettiest chunk of code in the whole plane system:
- -- Key inputs:
- local w = keyboard:IsDown(KEY_W)
- local a = keyboard:IsDown(KEY_A)
- local s = keyboard:IsDown(KEY_S)
- local d = keyboard:IsDown(KEY_D)
- local q = keyboard:IsDown(KEY_Q)
- local e = keyboard:IsDown(KEY_E)
- local z = keyboard:IsDown(KEY_Z)
- local x = keyboard:IsDown(KEY_X)
- -- Update controls:
- bank = ((a ~= d) and (d and 1 or -1) or 0)
- pitch = ((w ~= s) and (s and 1 or -1) or 0)
- yaw = ((q ~= e) and (e and 1 or -1) or 0)
- throttle = ((z ~= x) and (x and 1 or -1) or 0)
- end
- -- Invert pitch if user requests:
- if (guiController.InvertPitch) then
- pitch = -pitch
- end
- flyer.BankInput = bank
- flyer.PitchInput = pitch
- flyer.YawInput = yaw
- -- Update throttle:
- if (throttle ~= 0) then
- local t = flyer.Throttle + (throttle * dt * 0.2)
- t = (t < 0.5 and 0.5 or t > 1 and 1 or t)
- flyer.Throttle = t
- guiController:UpdateThrottle(t)
- end
- end
- -- Heartbeat:
- function PhysicsUpdate()
- ReadInput()
- flyer:Update()
- guiController:Update()
- -- Update server periodically with control inputs from pilot: (This allows replication of inputs to other clients)
- local now = tick()
- if ((now - lastServerUpdate) > SERVER_UPDATE_INTERVAL) then
- lastServerUpdate = now
- updated:FireServer("inputs", flyer.Throttle, flyer.BankInput, flyer.PitchInput, flyer.YawInput)
- end
- end
- -- RenderStep:
- function RenderUpdate()
- -- Update control animations and camera:
- flyer:UpdateControls()
- camLock.Update()
- end
- -- Keyboard Key Down:
- function KeyDown(keyCode)
- if (gamepad.IsConnected) then return end
- if (keyCode == Enum.KeyCode.C) then
- camLock.SwitchView(keyboard:IsDown(Enum.KeyCode.LeftShift) or keyboard:IsDown(Enum.KeyCode.RightShift))
- end
- end
- -- Gamepad Button Down:
- function GamepadButtonDown(button)
- if (button == Enum.KeyCode.ButtonR3) then
- camLock.SwitchView()
- end
- end
- -- Initialize client-side control of the aircraft:
- function Init()
- camLock.Lock(plane)
- guiController:Start(plane)
- flyer.Throttle = 0.5
- if (IS_MOBILE) then
- -- Hide mobile controls:
- modal = game:GetService("UserInputService").ModalEnabled
- game:GetService("UserInputService").ModalEnabled = true
- else
- -- Listen for gamepad buttons on PC and console:
- gamepad.ButtonDown:Connect(GamepadButtonDown)
- end
- -- Listen for the plane to not exist:
- plane.Changed:Connect(function(property)
- if (property == "Parent" and not plane.Parent) then
- exit.Value = true
- end
- end)
- -- If on PC (not console nor mobile):
- if (not IS_MOBILE and not IS_CONSOLE) then
- guiController:SetUsingGamepad(gamepad.IsConnected)
- gamepad.Connected:Connect(function()
- guiController:SetUsingGamepad(true)
- ReadInput = ReadGamepadInput
- end)
- gamepad.Disconnected:Connect(function()
- guiController:SetUsingGamepad(false)
- ReadInput = ReadKeyboardAndMouseInput
- end)
- keyboard.KeyDown:Connect(KeyDown)
- mouse.Moved:Connect(function(x, y, dx, dy)
- if (guiController.UseMouse and mouse:IsDown(Enum.UserInputType.MouseButton2)) then
- local rotH = -dx * 0.005
- local rotV = -dy * 0.005
- camLock.DeltaRotation(rotH, rotV)
- end
- end)
- mouse.ButtonUp:Connect(function(button)
- if (guiController.UseMouse and button == Enum.UserInputType.MouseButton2) then
- camLock.ResetRotation()
- end
- end)
- end
- -- Input function:
- if (IS_CONSOLE) then
- ReadInput = ReadGamepadInput
- elseif (IS_MOBILE) then
- ReadInput = ReadMobileInput
- else
- ReadInput = (gamepad.IsConnected and ReadGamepadInput or ReadKeyboardAndMouseInput)
- end
- -- Start listeners for RenderUpdate and Heartbeat:
- physicsUpdateHandle = game:GetService("RunService").Heartbeat:Connect(PhysicsUpdate)
- game:GetService("RunService"):BindToRenderStep(renderUpdateName, Enum.RenderPriority.Camera.Value, RenderUpdate)
- flyer:Startup()
- end
- -- Invoked when the player leaves the plane:
- function Stop()
- -- Shut down the flyer; disconnect handlers; reset camera; remove this script:
- camLock.Unlock()
- physicsUpdateHandle:Disconnect()
- game:GetService("RunService"):UnbindFromRenderStep(renderUpdateName)
- script.Exited:FireServer(flyer.Throttle, flyer.BankInput, flyer.PitchInput, flyer.YawInput)
- if (gui) then
- gui:Destroy()
- end
- if (IS_MOBILE) then
- game:GetService("UserInputService").ModalEnabled = modal
- end
- guiController:Stop()
- flyer:Shutdown()
- wait(0.1) -- Arbitrary yield; probably not needed
- script:Destroy()
- end
- -- The server-side Controller will switch 'exit' to 'true' when it
- -- is time for this script to remove itself (typically when the
- -- player leaves the pilot seat).
- exit.Changed:Connect(function(v)
- if (v) then
- Stop()
- end
- end)
- Init()
- end))
- ObjectValue51.Name = "Plane"
- ObjectValue51.Parent = LocalScript50
- BoolValue52.Name = "Exit"
- BoolValue52.Parent = LocalScript50
- ModuleScript53.Name = "Controls"
- ModuleScript53.Parent = LocalScript50
- table.insert(cors,sandbox(ModuleScript53,function()
- -- Controls
- -- Crazyman32
- -- October 9, 2015
- -- Updated January 19, 2017 for use in plane system
- --[[
- Controls.Keyboard
- Controls.Mouse
- Controls.Gamepad
- --]]
- local Controls = {
- Keyboard = require(script:WaitForChild("Keyboard"));
- Mouse = require(script:WaitForChild("Mouse"));
- Gamepad = require(script:WaitForChild("Gamepad"));
- Mobile = require(script:WaitForChild("Mobile"));
- }
- return Controls
- end))
- ModuleScript54.Name = "Mouse"
- ModuleScript54.Parent = ModuleScript53
- table.insert(cors,sandbox(ModuleScript54,function()
- -- Mouse
- -- Crazyman32
- -- October 9, 2015
- -- Modified January 31, 2016
- -- Added SetIcon and SetVisible methods
- -- Modified January 28, 2017
- -- Added DeltaX and DeltaY parameters to the Moved event
- --[[
- local mouse = require(this)
- FIELDS:
- (X, Y, Ignore)
- Int mouse.X
- Int mouse.Y
- Table mouse.Ignore
- METHODS:
- (IsDown, Project, ProjectFromCharacter, Ray, SetIcon, SetVisible)
- Boolean isDown: mouse:IsDown(UserInputType button)
- CFrame hit, Part target, Vector3 normal: mouse:Project([Number maxDistance = 999, Table ignoreListOverride])
- CFrame hit, Part target, Vector3 normal: mouse:ProjectFromCharacter([Number maxDistance = 999, Table ignoreListOverride])
- Ray mouseRay: mouse:Ray()
- void: mouse:SetIcon(String imageIcon)
- void: mouse:SetVisible(Boolean isVisible)
- EVENTS:
- (ButtonDown, ButtonUp, Moved, Scrolled)
- mouse.ButtonDown(UserInputType button, Vector3 position)
- mouse.ButtonUp(UserInputType button, Vector3 position)
- mouse.Moved(Int x, Int y, Int deltaX, Int deltaY)
- mouse.Scrolled(Int direction)
- --]]
- assert(game:GetService("RunService"):IsClient(), "Mouse can only be used from client")
- local Mouse = {
- X = 0;
- Y = 0;
- Ignore = {};
- }
- local player = game.Players.LocalPlayer
- local iconGui = Instance.new("ScreenGui")
- iconGui.Name = "IconGui"
- local iconImg = Instance.new("ImageLabel", iconGui)
- iconImg.Name = "Icon"
- iconImg.BackgroundTransparency = 1
- local userInput = game:GetService("UserInputService")
- local maxRayDistance = 999
- -- Mouse button references:
- local mButton1 = Enum.UserInputType.MouseButton1
- local mButton2 = Enum.UserInputType.MouseButton2
- local mButton3 = Enum.UserInputType.MouseButton3
- local mWheel = Enum.UserInputType.MouseWheel
- local mMovement = Enum.UserInputType.MouseMovement
- local buttonDown = {
- [mButton1] = false;
- [mButton2] = false;
- [mButton3] = false;
- }
- -- Create events:
- local onButtonDown = Instance.new("BindableEvent")
- local onButtonUp = Instance.new("BindableEvent")
- local onMoved = Instance.new("BindableEvent")
- local onScrolled = Instance.new("BindableEvent")
- -- Expose events:
- Mouse.ButtonDown = onButtonDown.Event
- Mouse.ButtonUp = onButtonUp.Event
- Mouse.Moved = onMoved.Event
- Mouse.Scrolled = onScrolled.Event
- -- Projections:
- do
- local workspace = game.Workspace
- local findPartOnRayWithIgnoreList = workspace.FindPartOnRayWithIgnoreList
- local cam = game.Workspace.CurrentCamera
- local Ray = Ray.new
- local screenPointToRay = cam.ScreenPointToRay
- local CF = CFrame.new
- function Mouse:Ray()
- return screenPointToRay(cam, self.X, self.Y, 0)
- end
- function Mouse:Project(maxDistance, ignore)
- local ray = screenPointToRay(cam, self.X, self.Y, 0)
- ray = Ray(ray.Origin, (ray.Unit.Direction * (maxDistance or maxRayDistance)))
- local hit, hitPos, normal = findPartOnRayWithIgnoreList(workspace, ray, ignore or self.Ignore or {}, true, false)
- local cframe = CF(hitPos, (hitPos + ray.Unit.Direction))
- return cframe, hit, normal
- end
- function Mouse:ProjectFromCharacter(maxDistance, ignore)
- if (player.Character) then
- local head = player.Character:FindFirstChild("Head")
- if (head) then
- maxDistance = (maxDistance or maxRayDistance)
- local cframe, hit, normal = self:Project(nil, ignore)
- cframe = CF(cframe.p, cframe.p + CF(head.Position, cframe.p).lookVector)
- local dist = (head.Position - cframe.p).Magnitude
- if (dist > maxDistance) then
- cframe = CF(head.Position + (cframe.lookVector * maxDistance), head.Position + (cframe.lookVector * maxDistance * 2))
- end
- return cframe, hit, normal
- end
- end
- end
- function Mouse:GetTarget()
- local cframe, hit, normal = self:Project()
- return hit
- end
- function Mouse:GetHitCFrame()
- local cframe, hit, normal = self:Project()
- return cframe
- end
- end
- function Mouse:IsDown(button)
- return buttonDown[button]
- end
- function Mouse:SetIcon(assetId)
- player:GetMouse().Icon = assetId
- end
- function Mouse:SetVisible(isVisible)
- userInput.MouseIconEnabled = isVisible
- end
- local function InputBegan(input, processed)
- if (processed) then return end
- local iType = input.UserInputType
- if (iType == mButton1 or iType == mButton2 or iType == mButton3) then
- buttonDown[iType] = true
- onButtonDown:Fire(iType, input.Position)
- end
- end
- local function InputEnded(input, processed)
- if (processed) then return end
- local iType = input.UserInputType
- if (iType == mButton1 or iType == mButton2 or iType == mButton3) then
- buttonDown[iType] = false
- onButtonUp:Fire(iType, input.Position)
- end
- end
- local function InputChanged(input, processed)
- if (processed) then return end
- local iType = input.UserInputType
- if (iType == mMovement) then
- local x, y = input.Position.X, input.Position.Y
- local dx, dy = (x - Mouse.X), (y - Mouse.Y)
- Mouse.X = x
- Mouse.Y = y
- onMoved:Fire(x, y, dx, dy)
- elseif (iType == mWheel) then
- onScrolled:Fire(input.Position.Z)
- end
- end
- userInput.InputBegan:Connect(InputBegan)
- userInput.InputEnded:Connect(InputEnded)
- userInput.InputChanged:Connect(InputChanged)
- return Mouse
- end))
- ModuleScript55.Name = "Keyboard"
- ModuleScript55.Parent = ModuleScript53
- table.insert(cors,sandbox(ModuleScript55,function()
- -- Keyboard
- -- Crazyman32
- -- October 9, 2015
- --[[
- local keyboard = require(this)
- METHODS:
- (IsDown)
- Boolean isDown: keyboard:IsDown(KeyCode key)
- EVENTS:
- (KeyDown, KeyUp)
- keyboard.KeyDown(KeyCode key)
- keyboard.KeyUp(KeyCode key)
- --]]
- assert(game:GetService("RunService"):IsClient(), "Keyboard can only be used from client")
- local Keyboard = {}
- local userInput = game:GetService("UserInputService")
- local isDown = {}
- local keyboardInput = Enum.UserInputType.Keyboard
- local onKeyDown = Instance.new("BindableEvent")
- local onKeyUp = Instance.new("BindableEvent")
- Keyboard.KeyDown = onKeyDown.Event
- Keyboard.KeyUp = onKeyUp.Event
- function Keyboard:IsDown(keyCode)
- return (isDown[keyCode] == true)
- end
- local function InputBegan(input, processed)
- if (processed) then return end
- if (input.UserInputType == keyboardInput) then
- local key = input.KeyCode
- isDown[key] = true
- onKeyDown:Fire(key)
- end
- end
- local function InputEnded(input, processed)
- if (processed) then return end
- if (input.UserInputType == keyboardInput) then
- local key = input.KeyCode
- isDown[key] = false
- onKeyUp:Fire(key)
- end
- end
- userInput.InputBegan:Connect(InputBegan)
- userInput.InputEnded:Connect(InputEnded)
- return Keyboard
- end))
- ModuleScript56.Name = "Gamepad"
- ModuleScript56.Parent = ModuleScript53
- table.insert(cors,sandbox(ModuleScript56,function()
- -- Gamepad
- -- Crazyman32
- -- January 19, 2017
- -- NOTE: Specifically listens for Gamepad1 controls only!!!
- --[[
- FIELDS:
- Gamepad.IsConnected > true|false
- METHODS:
- Gamepad:IsDown(keyCode) > true|false
- Gamepad:GetInput(keyCode) > returns InputObject associated with keycode (nil if none)
- Gamepad:GetPosition(keyCode) > Vector3 (will return 0,0,0 if no keycode available)
- EVENTS:
- Gamepad.ButtonDown(keyCode)
- Gamepad.ButtonUp(keyCode)
- Gamepad.Changed(keyCode)
- Gamepad.Connected()
- Gamepad.Disconnected()
- --]]
- local GAMEPAD1 = Enum.UserInputType.Gamepad1
- local ZERO_VECTOR = Vector3.new()
- local buttonDown = Instance.new("BindableEvent")
- local buttonUp = Instance.new("BindableEvent")
- local changed = Instance.new("BindableEvent")
- local connected = Instance.new("BindableEvent")
- local disconnected = Instance.new("BindableEvent")
- local down = {}
- local state = {}
- local Gamepad = {
- IsConnected = game:GetService("UserInputService"):GetGamepadConnected(GAMEPAD1);
- ButtonDown = buttonDown.Event;
- ButtonUp = buttonUp.Event;
- Changed = changed.Event;
- Connected = connected.Event;
- Disconnected = disconnected.Event;
- }
- function Gamepad:IsDown(keyCode)
- return (down[keyCode] == true)
- end
- function Gamepad:GetInput(keyCode)
- return state[keyCode]
- end
- function Gamepad:GetPosition(keyCode)
- local input = self:GetInput(keyCode)
- if (input) then
- return input.Position
- end
- return ZERO_VECTOR
- end
- function Reset()
- down = {}
- state = {}
- end
- function GetState()
- -- Map KeyCodes to corresponding InputObjects on the gamepad:
- local s = game:GetService("UserInputService"):GetGamepadState(GAMEPAD1)
- for _,inputObj in pairs(s) do
- state[inputObj.KeyCode] = inputObj
- end
- end
- function InputBegan(input, processed)
- if (input.UserInputType == GAMEPAD1) then
- down[input.KeyCode] = true
- buttonDown:Fire(input.KeyCode)
- end
- end
- function InputEnded(input, processed)
- if (input.UserInputType == GAMEPAD1) then
- down[input.KeyCode] = false
- buttonUp:Fire(input.KeyCode)
- end
- end
- function InputChanged(input, processed)
- if (input.UserInputType == GAMEPAD1) then
- changed:Fire(input.KeyCode)
- end
- end
- function GamepadConnected(gamepad)
- if (gamepad == GAMEPAD1) then
- Gamepad.IsConnected = true
- GetState()
- connected:Fire()
- end
- end
- function GamepadDisconnected(gamepad)
- if (gamepad == GAMEPAD1) then
- Gamepad.IsConnected = false
- Reset()
- disconnected:Fire()
- end
- end
- game:GetService("UserInputService").InputBegan:Connect(InputBegan)
- game:GetService("UserInputService").InputEnded:Connect(InputEnded)
- game:GetService("UserInputService").InputChanged:Connect(InputChanged)
- game:GetService("UserInputService").GamepadConnected:Connect(GamepadConnected)
- game:GetService("UserInputService").GamepadDisconnected:Connect(GamepadDisconnected)
- if (Gamepad.IsConnected) then
- GetState()
- end
- return Gamepad
- end))
- ModuleScript57.Name = "Mobile"
- ModuleScript57.Parent = ModuleScript53
- table.insert(cors,sandbox(ModuleScript57,function()
- -- Mobile
- -- Crazyman32
- -- January 26, 2017
- local Mobile = {
- Pitch = 0;
- Bank = 0;
- Yaw = 0;
- SwitchView = false;
- DeviceBank = 0;
- DevicePitch = 0;
- }
- local PI_HALF = math.pi * 0.5
- local ATAN2 = math.atan2
- local MAX_DEVICE_ROTATION = math.rad(60)
- local userInput = game:GetService("UserInputService")
- local initialGravity = Vector3.new()
- local accelEnabled = userInput.AccelerometerEnabled
- function ClampAndNormalize(n, lowHigh)
- return (n < -lowHigh and -lowHigh or n > lowHigh and lowHigh or n) / lowHigh
- end
- function DeviceGravityChanged(gravity)
- gravity = (gravity.Position + initialGravity)
- -- Thanks to Fractality_alt for the below algorithm:
- local gravX, gravY, gravZ = gravity.X, gravity.Y, gravity.Z
- local bank = (gravX > 0 and PI_HALF or -PI_HALF) - ATAN2(gravX, gravZ)
- local pitch = ATAN2(gravY, (gravX * gravX + gravZ * gravZ) ^ 0.5)
- Mobile.Bank = -ClampAndNormalize(bank, MAX_DEVICE_ROTATION)
- Mobile.Pitch = -ClampAndNormalize(pitch, MAX_DEVICE_ROTATION)
- Mobile.DeviceBank = bank
- Mobile.DevicePitch = pitch
- end
- if (accelEnabled) then
- initialGravity = userInput:GetDeviceGravity().Position
- userInput.DeviceGravityChanged:Connect(DeviceGravityChanged)
- end
- --[[
- userInput.TouchLongPress:Connect(function(touchPositions, state, processed)
- if (processed or state ~= Enum.UserInputState.Begin) then return end
- Mobile.SwitchView = true
- end)
- ]]
- return Mobile
- end))
- RemoteEvent58.Name = "Exited"
- RemoteEvent58.Parent = LocalScript50
- RemoteEvent59.Name = "Updated"
- RemoteEvent59.Parent = LocalScript50
- ModuleScript60.Name = "CamLock"
- ModuleScript60.Parent = LocalScript50
- table.insert(cors,sandbox(ModuleScript60,function()
- -- Cam Lock
- -- Crazyman32
- -- January 23, 2017
- --[[
- Specialized library for the plane's camera.
- Note my inconsistency by using "." accessors
- for methods instead of ":" accessors. Sorry.
- CamLock.Update() [Should be called every RenderStep]
- CamLock.Lock(planeModel)
- CamLock.Unlock()
- CamLock.SwitchView([reversed])
- CamLock.SetMobileDeviceBank(bank)
- CamLock.SetRotation(horizontalRadians, verticalRadians)
- CamLock.DeltaRotation(deltaHorizontalRadians, deltaVerticalRadians)
- CamLock.ResetRotation()
- --]]
- -- Time it takes to tween between view switches:
- local TWEEN_DURATION = 0.25
- local V3 = Vector3.new
- local CF = CFrame.new
- local ANG = CFrame.Angles
- local ACOS = math.acos
- local COS = math.cos
- local SIN = math.sin
- local RAND = math.random
- local TAU = math.pi * 2
- local CamLock = {}
- local cam = game.Workspace.CurrentCamera
- local plane
- local seat
- local currentViewIndex = 1
- local currentView
- local viewRotH = 0
- local viewRotV = 0
- local MAX_VIEW_ROT_V = math.rad(80)
- local mobileDeviceBank = 0
- local Damping = require(script:WaitForChild("Damping"))
- local easing = require(script:WaitForChild("Easing"))
- local dampCam = Damping.new()
- local dampRot = Damping.new()
- local dampShake = Damping.new()
- dampShake.P = 3
- dampShake.D = 0.05
- local tweening = false
- local tweenStart = 0
- local tweenFromView = nil
- local views = {
- -- Pivot: Point around which camera rotates
- -- Offset: Camera offset from pivot point
- -- Ease: Ease function used when tweening into the view
- -- Third-person:
- {
- Pivot = CF(0, 3.5, -1.1);
- Offset = CF(0, 8, 40);
- Ease = easing.outQuint;
- };
- -- First-person:
- {
- Pivot = CF(0, 3.5, -1.1);
- Offset = CF(0, 0, 0);
- Ease = easing.outQuint;
- };
- -- Landing gear:
- {
- Pivot = CF(0, -3.5, -0.5);
- Offset = CF(0, 0, 0);
- Ease = easing.outQuint;
- };
- }
- -- Clamp a vector to a max given magnitude:
- local function ClampMagnitude(vector, mag)
- return (vector.Magnitude > mag and (vector.Unit * mag) or vector)
- end
- -- Clamp a number between low and high:
- local function Clamp(n, low, high)
- return (n < low and low or n > high and high or n)
- end
- -- Get the angle between two vectors:
- local function Angle(from, to)
- return ACOS(Clamp(from.Unit:Dot(to.Unit), -1, 1))
- end
- -- Set rotation of camera around pivot point:
- local function SetRotation(h, v)
- viewRotH = h
- viewRotV = Clamp(v, -MAX_VIEW_ROT_V, MAX_VIEW_ROT_V)
- dampRot.Goal = V3(viewRotH, viewRotV, 0)
- end
- -- Simulate camera shake (not great, but works well enough for this):
- local function GetCameraShake()
- local dragAngle = Angle(seat.CFrame.lookVector, seat.Velocity)
- local speed = seat.Velocity.Magnitude
- local shakeMagnitude = (speed * 0.02) * dragAngle * 0.1
- local theta = RAND() * TAU
- local x = COS(theta) * shakeMagnitude
- local y = SIN(theta) * shakeMagnitude
- -- ^
- -- THE STARS ALIGN ^ DUN DUN DUN
- -- ^
- return V3(x, y, 0)
- end
- local function GetCameraRotation()
- -- Relative rotational velocity:
- dampCam.Goal = -seat.CFrame:vectorToObjectSpace(seat.RotVelocity) * 0.1
- local relRotVel = dampCam:Update()
- -- Camera shake offset:
- dampShake.Goal = GetCameraShake()
- local shake = CF(dampShake:Update())
- -- User view rotation:
- local viewRotation = dampRot:Update()
- viewRotation = ANG(0, viewRotation.X, 0) * ANG(viewRotation.Y, 0, 0)
- return ANG(0, 0, mobileDeviceBank) * viewRotation * ANG(relRotVel.X, relRotVel.Y, relRotVel.Z) * shake
- end
- -- Get the CFrame of the given view with proper view rotations (before any tweening is done):
- local function GetViewCFrame(view, rotation)
- return seat.CFrame * view.Pivot * rotation * view.Offset
- end
- -- Update the camera without tweening:
- local function Update()
- local camRotation = GetCameraRotation()
- cam.CFrame = GetViewCFrame(currentView, camRotation)
- end
- -- Update the camera with tweening: (Used instead of Update function when animating between views)
- local function UpdateWithTween()
- local duration = (tick() - tweenStart)
- if (duration >= TWEEN_DURATION) then
- duration = TWEEN_DURATION
- CamLock.Update = Update
- tweening = false
- end
- local camRotation = GetCameraRotation()
- local tweenAmount = currentView.Ease(duration, 0, 1, TWEEN_DURATION)
- local cf0 = GetViewCFrame(tweenFromView, camRotation)
- local cf1 = GetViewCFrame(currentView, camRotation)
- cam.CFrame = cf0:lerp(cf1, tweenAmount)
- -- If you like unreadable code, here's the above chunk (from camRotation) in one step:
- --cam.CFrame = GetViewCFrame(tweenFromView, GetCameraRotation()):lerp(GetViewCFrame(currentView, GetCameraRotation()), currentView.Ease(duration, 0, 1, TWEEN_DURATION))
- end
- -- Default to Update for the CamLock.Update function.
- -- This is dynamically switched to UpdateWithTweeen when animating between views.
- CamLock.Update = Update
- -- Switch to the next (or previous) view:
- function CamLock.SwitchView(reverse)
- if (tweening) then return end
- tweenFromView = currentView
- currentViewIndex = (currentViewIndex + (reverse and -1 or 1))
- currentViewIndex = (currentViewIndex < 1 and #views or currentViewIndex > #views and 1 or currentViewIndex)
- currentView = views[currentViewIndex]
- if (tweenFromView ~= currentView) then
- tweening = true
- tweenStart = tick()
- CamLock.Update = UpdateWithTween
- end
- end
- -- Set the rotation:
- function CamLock.SetRotation(horizontal, vertical)
- SetRotation(horizontal, vertical)
- end
- -- Change the rotation:
- function CamLock.DeltaRotation(horizontal, vertical)
- SetRotation(viewRotH + horizontal, viewRotV + vertical)
- end
- -- Reset the rotation:
- function CamLock.ResetRotation()
- SetRotation(0, 0)
- end
- -- Set camera tilt correction for mobile:
- function CamLock.SetMobileDeviceBank(bank)
- mobileDeviceBank = bank
- end
- -- Lock the view:
- function CamLock.Lock(p)
- cam.CameraType = Enum.CameraType.Scriptable
- plane = p
- seat = plane:WaitForChild("Functional"):WaitForChild("PilotSeat")
- currentView = views[currentViewIndex]
- end
- -- Unlock the camera:
- function CamLock.Unlock()
- cam.CameraType = Enum.CameraType.Custom
- plane = nil
- end
- return CamLock
- end))
- ModuleScript61.Name = "Easing"
- ModuleScript61.Parent = ModuleScript60
- table.insert(cors,sandbox(ModuleScript61,function()
- -- https://github.com/EmmanuelOga/easing
- local F=math.pow local r=math.sin local h=math.cos local s=math.pi local o=math.sqrt local b=math.abs local p=math.asin local function m(c,b,a,d)return a*c/d+b end local function E(d,b,a,c)d=d/c return a*F(d,2)+b end local function y(d,c,a,b)d=d/b return-a*d*(d-2)+c end local function k(d,b,c,a)d=d/a*2 if d<1 then return c/2*F(d,2)+b else return-c/2*((d-1)*(d-3)-1)+b end end local function l(c,a,b,d)if c<d/2 then return y(c*2,a,b/2,d)else return E((c*2)-d,a+b/2,b/2,d)end end local function z(d,a,b,c)d=d/c return b*F(d,3)+a end local function B(d,b,a,c)d=d/c-1 return a*(F(d,3)+1)+b end local function j(d,b,c,a)d=d/a*2 if d<1 then return c/2*d*d*d+b else d=d-2 return c/2*(d*d*d+2)+b end end local function e(c,a,b,d)if c<d/2 then return B(c*2,a,b/2,d)else return z((c*2)-d,a+b/2,b/2,d)end end local function A(d,a,c,b)d=d/b return c*F(d,4)+a end local function H(d,c,b,a)d=d/a-1 return-b*(F(d,4)-1)+c end local function d(d,c,b,a)d=d/a*2 if d<1 then return b/2*F(d,4)+c else d=d-2 return-b/2*(F(d,4)-2)+c end end local function c(c,a,b,d)if c<d/2 then return H(c*2,a,b/2,d)else return A((c*2)-d,a+b/2,b/2,d)end end local function D(d,b,a,c)d=d/c return a*F(d,5)+b end local function C(d,c,b,a)d=d/a-1 return b*(F(d,5)+1)+c end local function f(d,b,c,a)d=d/a*2 if d<1 then return c/2*F(d,5)+b else d=d-2 return c/2*(F(d,5)+2)+b end end local function g(c,a,b,d)if c<d/2 then return C(c*2,a,b/2,d)else return D((c*2)-d,a+b/2,b/2,d)end end local function w(a,b,d,c)return-d*h(a/c*(s/2))+d+b end local function L(c,d,a,b)return a*r(c/b*(s/2))+d end local function i(d,c,a,b)return-a/2*(h(s*d/b)-1)+c end local function h(b,a,c,d)if b<d/2 then return L(b*2,a,c/2,d)else return w((b*2)-d,a+c/2,c/2,d)end end local function I(b,c,d,a)if b==0 then return c else return d*F(2,10*(b/a-1))+c-d*0.001 end end local function K(b,a,c,d)if b==d then return a+c else return c*1.001*(-F(2,-10*b/d)+1)+a end end local function t(d,c,b,a)if d==0 then return c end if d==a then return c+b end d=d/a*2 if d<1 then return b/2*F(2,10*(d-1))+c-b*0.0005 else d=d-1 return b/2*1.0005*(-F(2,-10*d)+2)+c end end local function n(b,a,c,d)if b<d/2 then return K(b*2,a,c/2,d)else return I((b*2)-d,a+c/2,c/2,d)end end local function v(d,c,a,b)d=d/b return(-a*(o(1-F(d,2))-1)+c)end local function x(d,c,b,a)d=d/a-1 return(b*o(1-F(d,2))+c)end local function u(d,b,c,a)d=d/a*2 if d<1 then return-c/2*(o(1-d*d)-1)+b else d=d-2 return c/2*(o(1-d*d)+1)+b end end local function o(c,a,b,d)if c<d/2 then return x(c*2,a,b/2,d)else return v((c*2)-d,a+b/2,b/2,d)end end local function G(h,a,e,c,f,g)if h==0 then return a end h=h/c if h==1 then return a+e end if not g then g=c*0.3 end local d if not f or f<b(e)then f=e d=g/4 else d=g/(2*s)*p(e/f)end h=h-1 return-(f*F(2,10*h)*r((h*c-d)*(2*s)/g))+a end local function M(h,d,f,c,g,e)if h==0 then return d end h=h/c if h==1 then return d+f end if not e then e=c*0.3 end local a if not g or g<b(f)then g=f a=e/4 else a=e/(2*s)*p(f/g)end return g*F(2,-10*h)*r((h*c-a)*(2*s)/e)+f+d end local function q(h,d,e,c,g,f)if h==0 then return d end h=h/c*2 if h==2 then return d+e end if not f then f=c*(0.3*1.5)end if not g then g=0 end local a if not g or g<b(e)then g=e a=f/4 else a=f/(2*s)*p(e/g)end if h<1 then h=h-1 return-0.5*(g*F(2,10*h)*r((h*c-a)*(2*s)/f))+d else h=h-1 return g*F(2,-10*h)*r((h*c-a)*(2*s)/f)*0.5+e+d end end local function p(e,c,d,f,a,b)if e<f/2 then return M(e*2,c,d/2,f,a,b)else return G((e*2)-f,c+d/2,d/2,f,a,b)end end local function J(e,c,b,a,d)if not d then d=1.70158 end e=e/a return b*e*e*((d+1)*e-d)+c end local function F(e,a,b,c,d)if not d then d=1.70158 end e=e/c-1 return b*(e*e*((d+1)*e+d)+1)+a end local function r(e,c,b,a,d)if not d then d=1.70158 end d=d*1.525 e=e/a*2 if e<1 then return b/2*(e*e*((d+1)*e-d))+c else e=e-2 return b/2*(e*e*((d+1)*e+d)+2)+c end end local function s(c,a,d,e,b)if c<e/2 then return F(c*2,a,d/2,e,b)else return J((c*2)-e,a+d/2,d/2,e,b)end end local function O(d,b,c,a)d=d/a if d<1/2.75 then return c*(7.5625*d*d)+b elseif d<2/2.75 then d=d-(1.5/2.75)return c*(7.5625*d*d+0.75)+b elseif d<2.5/2.75 then d=d-(2.25/2.75)return c*(7.5625*d*d+0.9375)+b else d=d-(2.625/2.75)return c*(7.5625*d*d+0.984375)+b end end local function N(a,b,d,c)return d-O(c-a,0,d,c)+b end local function b(c,a,b,d)if c<d/2 then return N(c*2,0,b,d)*0.5+a else return O(c*2-d,0,b,d)*0.5+b*.5+a end end local function a(b,a,c,d)if b<d/2 then return O(b*2,a,c/2,d)else return N((b*2)-d,a+c/2,c/2,d)end end return{linear=m,inQuad=E,outQuad=y,inOutQuad=k,outInQuad=l,inCubic=z,outCubic=B,inOutCubic=j,outInCubic=e,inQuart=A,outQuart=H,inOutQuart=d,outInQuart=c,inQuint=D,outQuint=C,inOutQuint=f,outInQuint=g,inSine=w,outSine=L,inOutSine=i,outInSine=h,inExpo=I,outExpo=K,inOutExpo=t,outInExpo=n,inCirc=v,outCirc=x,inOutCirc=u,outInCirc=o,inElastic=G,outElastic=M,inOutElastic=q,outInElastic=p,inBack=J,outBack=F,inOutBack=r,outInBack=s,inBounce=N,outBounce=O,inOutBounce=b,outInBounce=a}
- end))
- ModuleScript62.Name = "Damping"
- ModuleScript62.Parent = ModuleScript60
- table.insert(cors,sandbox(ModuleScript62,function()
- -- Damping
- -- Crazyman32
- -- September 30, 2015
- -- Updated: January 1, 2017
- --[[
- local Damping = require(this)
- local damping = Damping.new()
- damping.P = NUMBER
- damping.D = NUMBER
- damping.Position = Vector3
- damping.Goal = Vector3
- damping:Update() [Returns Vector3 position]
- damping:UpdateAngle() [Returns Vector3 position, but each XYZ value is wrapped properly for pi*2 motion]
- EXAMPLE USE:
- -- Set D and P values:
- damping.P = 5
- damping.D = 0.1
- -- Set starting position:
- damping.Position = part.Position
- while (true) do
- wait()
- -- Update the goal:
- damping.Goal = mouse.Hit.p
- -- Calculate new position:
- local newPosition = damping:Update()
- part.Position = newPosition
- end
- ALGORITHM:
- velocity += P * ( (target - current) + D * -velocity );
- current += velocity * dt;
- Credit: http://www.gamedev.net/topic/561981-smooth-value-damping/
- --]]
- local Damping = {}
- Damping.__index = Damping
- local V3 = Vector3.new
- local PI = math.pi
- local TAU = PI * 2
- local tick = tick
- local function CheckNAN(value, returnIfNan)
- return (value == value and value or returnIfNan)
- end
- local function DeltaAngle(current, target)
- local num = (target - current) % TAU
- return (num > PI and (num - TAU) or num)
- end
- local function DeltaAngleV3(pos1, pos2)
- return V3(
- DeltaAngle(pos1.X, pos2.X),
- DeltaAngle(pos1.Y, pos2.Y),
- DeltaAngle(pos1.Z, pos2.Z)
- )
- end
- function Damping.new()
- local damping = setmetatable({
- P = 5;
- D = 0.1;
- Position = V3();
- Velocity = V3();
- Goal = V3();
- Last = tick();
- }, Damping)
- return damping
- end
- function Damping:CheckNAN()
- self.Velocity = V3(CheckNAN(self.Velocity.X, 0), CheckNAN(self.Velocity.Y, 0), CheckNAN(self.Velocity.Z, 0))
- self.Position = V3(CheckNAN(self.Position.X, self.Goal.X), CheckNAN(self.Position.Y, self.Goal.Y), CheckNAN(self.Position.Z, self.Goal.Z))
- end
- function Damping:Update()
- local t = tick()
- local dt = (t - self.Last)
- self.Last = t
- self.Velocity = (self.Velocity + (self.P * ((self.Goal - self.Position) + (-self.Velocity * self.D))))
- self.Position = (self.Position + (self.Velocity * dt))
- self:CheckNAN()
- return self.Position
- end
- function Damping:UpdateAngle()
- self.Goal = (self.Position + DeltaAngleV3(self.Position, self.Goal))
- return self:Update()
- end
- return Damping
- end))
- ScreenGui63.Name = "PlaneConsoleGui"
- ScreenGui63.Parent = LocalScript50
- Frame64.Name = "Throttle"
- Frame64.Parent = ScreenGui63
- Frame64.Position = UDim2.new(0, 80, 1, -40)
- Frame64.Size = UDim2.new(0, 350, 0, -20)
- Frame64.BackgroundColor = BrickColor.new("Black")
- Frame64.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame64.BorderSizePixel = 0
- TextLabel65.Name = "Label"
- TextLabel65.Parent = Frame64
- TextLabel65.Position = UDim2.new(0, 0, 0, -20)
- TextLabel65.Size = UDim2.new(1, 0, 0, -20)
- TextLabel65.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel65.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel65.BackgroundTransparency = 1
- TextLabel65.Font = Enum.Font.SourceSans
- TextLabel65.FontSize = Enum.FontSize.Size48
- TextLabel65.Text = "THROTTLE"
- TextLabel65.TextColor = BrickColor.new("Institutional white")
- TextLabel65.TextColor3 = Color3.new(1, 1, 1)
- TextLabel65.TextSize = 42
- TextLabel65.TextStrokeTransparency = 0.80000001192093
- TextLabel65.TextWrap = true
- TextLabel65.TextWrapped = true
- Frame66.Name = "Knob"
- Frame66.Parent = Frame64
- Frame66.Position = UDim2.new(0, 0, 0.5, -15)
- Frame66.Size = UDim2.new(0, 20, 0, 30)
- Frame66.BackgroundColor = BrickColor.new("Institutional white")
- Frame66.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame66.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame66.BorderSizePixel = 2
- Frame66.ZIndex = 2
- Frame67.Name = "Bar"
- Frame67.Parent = Frame64
- Frame67.Size = UDim2.new(0, 0, 1, 0)
- Frame67.BackgroundColor = BrickColor.new("Institutional white")
- Frame67.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame67.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame67.BorderSizePixel = 2
- TextButton68.Name = "Grab"
- TextButton68.Parent = Frame64
- TextButton68.Position = UDim2.new(0, -10, 0, -15)
- TextButton68.Size = UDim2.new(1, 20, 1, 30)
- TextButton68.BackgroundColor = BrickColor.new("Really red")
- TextButton68.BackgroundColor3 = Color3.new(1, 0, 0)
- TextButton68.BackgroundTransparency = 1
- TextButton68.Draggable = true
- TextButton68.ZIndex = 3
- TextButton68.Font = Enum.Font.SourceSans
- TextButton68.FontSize = Enum.FontSize.Size14
- TextButton68.Text = ""
- TextButton68.TextSize = 14
- TextLabel69.Name = "RT"
- TextLabel69.Parent = Frame64
- TextLabel69.Position = UDim2.new(1, 10, 0, 0)
- TextLabel69.Size = UDim2.new(0, 0, 1, 0)
- TextLabel69.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel69.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel69.BackgroundTransparency = 1
- TextLabel69.Font = Enum.Font.SourceSansBold
- TextLabel69.FontSize = Enum.FontSize.Size48
- TextLabel69.Text = "RT"
- TextLabel69.TextColor = BrickColor.new("Institutional white")
- TextLabel69.TextColor3 = Color3.new(1, 1, 1)
- TextLabel69.TextSize = 42
- TextLabel69.TextStrokeTransparency = 0.80000001192093
- TextLabel69.TextWrap = true
- TextLabel69.TextWrapped = true
- TextLabel69.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel70.Name = "LT"
- TextLabel70.Parent = Frame64
- TextLabel70.Position = UDim2.new(0, -10, 0, 0)
- TextLabel70.Size = UDim2.new(0, 0, 1, 0)
- TextLabel70.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel70.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel70.BackgroundTransparency = 1
- TextLabel70.Font = Enum.Font.SourceSansBold
- TextLabel70.FontSize = Enum.FontSize.Size48
- TextLabel70.Text = "LT"
- TextLabel70.TextColor = BrickColor.new("Institutional white")
- TextLabel70.TextColor3 = Color3.new(1, 1, 1)
- TextLabel70.TextSize = 42
- TextLabel70.TextStrokeTransparency = 0.80000001192093
- TextLabel70.TextWrap = true
- TextLabel70.TextWrapped = true
- TextLabel70.TextXAlignment = Enum.TextXAlignment.Right
- Frame71.Name = "Speed"
- Frame71.Parent = ScreenGui63
- Frame71.Position = UDim2.new(0, 550, 1, -30)
- Frame71.Size = UDim2.new(0, 200, 0, -40)
- Frame71.BackgroundColor = BrickColor.new("Black")
- Frame71.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame71.BorderSizePixel = 0
- TextLabel72.Name = "Label"
- TextLabel72.Parent = Frame71
- TextLabel72.Position = UDim2.new(0, 0, 0, -10)
- TextLabel72.Size = UDim2.new(1, 0, 0, -20)
- TextLabel72.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel72.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel72.BackgroundTransparency = 1
- TextLabel72.Font = Enum.Font.SourceSans
- TextLabel72.FontSize = Enum.FontSize.Size48
- TextLabel72.Text = "SPEED"
- TextLabel72.TextColor = BrickColor.new("Institutional white")
- TextLabel72.TextColor3 = Color3.new(1, 1, 1)
- TextLabel72.TextSize = 42
- TextLabel72.TextStrokeTransparency = 0.80000001192093
- TextLabel72.TextWrap = true
- TextLabel72.TextWrapped = true
- TextLabel73.Name = "Amount"
- TextLabel73.Parent = Frame71
- TextLabel73.Size = UDim2.new(1, 0, 1, 0)
- TextLabel73.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel73.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel73.BackgroundTransparency = 1
- TextLabel73.Font = Enum.Font.Code
- TextLabel73.FontSize = Enum.FontSize.Size14
- TextLabel73.Text = "0"
- TextLabel73.TextColor = BrickColor.new("Institutional white")
- TextLabel73.TextColor3 = Color3.new(1, 1, 1)
- TextLabel73.TextScaled = true
- TextLabel73.TextSize = 14
- TextLabel73.TextWrap = true
- TextLabel73.TextWrapped = true
- Frame74.Name = "Altitude"
- Frame74.Parent = ScreenGui63
- Frame74.Position = UDim2.new(0, 800, 1, -30)
- Frame74.Size = UDim2.new(0, 200, 0, -40)
- Frame74.BackgroundColor = BrickColor.new("Black")
- Frame74.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame74.BorderSizePixel = 0
- TextLabel75.Name = "Label"
- TextLabel75.Parent = Frame74
- TextLabel75.Position = UDim2.new(0, 0, 0, -10)
- TextLabel75.Size = UDim2.new(1, 0, 0, -20)
- TextLabel75.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel75.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel75.BackgroundTransparency = 1
- TextLabel75.Font = Enum.Font.SourceSans
- TextLabel75.FontSize = Enum.FontSize.Size48
- TextLabel75.Text = "ALTITUDE"
- TextLabel75.TextColor = BrickColor.new("Institutional white")
- TextLabel75.TextColor3 = Color3.new(1, 1, 1)
- TextLabel75.TextSize = 42
- TextLabel75.TextStrokeTransparency = 0.80000001192093
- TextLabel75.TextWrap = true
- TextLabel75.TextWrapped = true
- TextLabel76.Name = "Amount"
- TextLabel76.Parent = Frame74
- TextLabel76.Size = UDim2.new(1, 0, 1, 0)
- TextLabel76.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel76.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel76.BackgroundTransparency = 1
- TextLabel76.Font = Enum.Font.Code
- TextLabel76.FontSize = Enum.FontSize.Size14
- TextLabel76.Text = "0"
- TextLabel76.TextColor = BrickColor.new("Institutional white")
- TextLabel76.TextColor3 = Color3.new(1, 1, 1)
- TextLabel76.TextScaled = true
- TextLabel76.TextSize = 14
- TextLabel76.TextWrap = true
- TextLabel76.TextWrapped = true
- ModuleScript77.Name = "GuiController"
- ModuleScript77.Parent = ScreenGui63
- table.insert(cors,sandbox(ModuleScript77,function()
- -- Gui Controller (For console)
- -- Crazyman32
- -- January 26, 2017
- local GuiController = {
- Throttle = 0;
- }
- local gui = script.Parent
- local plane
- local primary
- local spd, alt
- function ThrottleSetup()
- local throttle = gui:WaitForChild("Throttle")
- local grab = throttle:WaitForChild("Grab")
- local bar = throttle:WaitForChild("Bar")
- local knob = throttle:WaitForChild("Knob")
- local grabPos = grab.Position
- local grabSize = grab.Size
- function GuiController:UpdateThrottle(throttle)
- local xRatio = (throttle - 0.5) * 2
- bar.Size = UDim2.new(xRatio, 0, 1, 0)
- knob.Position = UDim2.new(xRatio, -knob.AbsoluteSize.X * xRatio, 0.5, -15)
- end
- end
- function GuiController:Update()
- spd.Text = tostring(math.floor(primary.Velocity.Magnitude))
- alt.Text = tostring(math.floor(primary.Position.Y))
- end
- function GuiController:Start(p)
- plane = p
- primary = plane.PrimaryPart
- ThrottleSetup()
- spd = gui:WaitForChild("Speed"):WaitForChild("Amount")
- alt = gui:WaitForChild("Altitude"):WaitForChild("Amount")
- end
- function GuiController:Stop()
- end
- return GuiController
- end))
- ScreenGui78.Name = "PlaneGui"
- ScreenGui78.Parent = LocalScript50
- Frame79.Name = "Throttle"
- Frame79.Parent = ScreenGui78
- Frame79.Position = UDim2.new(0, 80, 1, -40)
- Frame79.Size = UDim2.new(0, 350, 0, -20)
- Frame79.BackgroundColor = BrickColor.new("Black")
- Frame79.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame79.BorderSizePixel = 0
- TextLabel80.Name = "Label"
- TextLabel80.Parent = Frame79
- TextLabel80.Position = UDim2.new(0, 0, 0, -20)
- TextLabel80.Size = UDim2.new(1, 0, 0, -20)
- TextLabel80.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel80.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel80.BackgroundTransparency = 1
- TextLabel80.Font = Enum.Font.SourceSans
- TextLabel80.FontSize = Enum.FontSize.Size48
- TextLabel80.Text = "THROTTLE"
- TextLabel80.TextColor = BrickColor.new("Institutional white")
- TextLabel80.TextColor3 = Color3.new(1, 1, 1)
- TextLabel80.TextSize = 42
- TextLabel80.TextStrokeTransparency = 0.80000001192093
- TextLabel80.TextWrap = true
- TextLabel80.TextWrapped = true
- Frame81.Name = "Knob"
- Frame81.Parent = Frame79
- Frame81.Position = UDim2.new(0, 0, 0.5, -15)
- Frame81.Size = UDim2.new(0, 20, 0, 30)
- Frame81.BackgroundColor = BrickColor.new("Institutional white")
- Frame81.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame81.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame81.BorderSizePixel = 2
- Frame81.ZIndex = 2
- Frame82.Name = "Bar"
- Frame82.Parent = Frame79
- Frame82.Size = UDim2.new(0, 0, 1, 0)
- Frame82.BackgroundColor = BrickColor.new("Institutional white")
- Frame82.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame82.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame82.BorderSizePixel = 2
- TextButton83.Name = "Grab"
- TextButton83.Parent = Frame79
- TextButton83.Position = UDim2.new(0, -10, 0, -15)
- TextButton83.Size = UDim2.new(1, 20, 1, 30)
- TextButton83.BackgroundColor = BrickColor.new("Really red")
- TextButton83.BackgroundColor3 = Color3.new(1, 0, 0)
- TextButton83.BackgroundTransparency = 1
- TextButton83.Draggable = true
- TextButton83.ZIndex = 3
- TextButton83.Font = Enum.Font.SourceSans
- TextButton83.FontSize = Enum.FontSize.Size14
- TextButton83.Text = ""
- TextButton83.TextSize = 14
- TextLabel84.Name = "RT"
- TextLabel84.Parent = Frame79
- TextLabel84.Position = UDim2.new(1, 10, 0, 0)
- TextLabel84.Size = UDim2.new(0, 0, 1, 0)
- TextLabel84.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel84.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel84.BackgroundTransparency = 1
- TextLabel84.Font = Enum.Font.SourceSansBold
- TextLabel84.FontSize = Enum.FontSize.Size48
- TextLabel84.Text = "RT"
- TextLabel84.TextColor = BrickColor.new("Institutional white")
- TextLabel84.TextColor3 = Color3.new(1, 1, 1)
- TextLabel84.TextSize = 42
- TextLabel84.TextStrokeTransparency = 0.80000001192093
- TextLabel84.TextWrap = true
- TextLabel84.TextWrapped = true
- TextLabel84.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel85.Name = "LT"
- TextLabel85.Parent = Frame79
- TextLabel85.Position = UDim2.new(0, -10, 0, 0)
- TextLabel85.Size = UDim2.new(0, 0, 1, 0)
- TextLabel85.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel85.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel85.BackgroundTransparency = 1
- TextLabel85.Font = Enum.Font.SourceSansBold
- TextLabel85.FontSize = Enum.FontSize.Size48
- TextLabel85.Text = "LT"
- TextLabel85.TextColor = BrickColor.new("Institutional white")
- TextLabel85.TextColor3 = Color3.new(1, 1, 1)
- TextLabel85.TextSize = 42
- TextLabel85.TextStrokeTransparency = 0.80000001192093
- TextLabel85.TextWrap = true
- TextLabel85.TextWrapped = true
- TextLabel85.TextXAlignment = Enum.TextXAlignment.Right
- Frame86.Name = "Speed"
- Frame86.Parent = ScreenGui78
- Frame86.Position = UDim2.new(0, 550, 1, -30)
- Frame86.Size = UDim2.new(0, 200, 0, -40)
- Frame86.BackgroundColor = BrickColor.new("Black")
- Frame86.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame86.BorderSizePixel = 0
- TextLabel87.Name = "Label"
- TextLabel87.Parent = Frame86
- TextLabel87.Position = UDim2.new(0, 0, 0, -10)
- TextLabel87.Size = UDim2.new(1, 0, 0, -20)
- TextLabel87.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel87.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel87.BackgroundTransparency = 1
- TextLabel87.Font = Enum.Font.SourceSans
- TextLabel87.FontSize = Enum.FontSize.Size48
- TextLabel87.Text = "SPEED"
- TextLabel87.TextColor = BrickColor.new("Institutional white")
- TextLabel87.TextColor3 = Color3.new(1, 1, 1)
- TextLabel87.TextSize = 42
- TextLabel87.TextStrokeTransparency = 0.80000001192093
- TextLabel87.TextWrap = true
- TextLabel87.TextWrapped = true
- TextLabel88.Name = "Amount"
- TextLabel88.Parent = Frame86
- TextLabel88.Size = UDim2.new(1, 0, 1, 0)
- TextLabel88.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel88.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel88.BackgroundTransparency = 1
- TextLabel88.Font = Enum.Font.Code
- TextLabel88.FontSize = Enum.FontSize.Size14
- TextLabel88.Text = "0"
- TextLabel88.TextColor = BrickColor.new("Institutional white")
- TextLabel88.TextColor3 = Color3.new(1, 1, 1)
- TextLabel88.TextScaled = true
- TextLabel88.TextSize = 14
- TextLabel88.TextWrap = true
- TextLabel88.TextWrapped = true
- Frame89.Name = "Altitude"
- Frame89.Parent = ScreenGui78
- Frame89.Position = UDim2.new(0, 800, 1, -30)
- Frame89.Size = UDim2.new(0, 200, 0, -40)
- Frame89.BackgroundColor = BrickColor.new("Black")
- Frame89.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame89.BorderSizePixel = 0
- TextLabel90.Name = "Label"
- TextLabel90.Parent = Frame89
- TextLabel90.Position = UDim2.new(0, 0, 0, -10)
- TextLabel90.Size = UDim2.new(1, 0, 0, -20)
- TextLabel90.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel90.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel90.BackgroundTransparency = 1
- TextLabel90.Font = Enum.Font.SourceSans
- TextLabel90.FontSize = Enum.FontSize.Size48
- TextLabel90.Text = "ALTITUDE"
- TextLabel90.TextColor = BrickColor.new("Institutional white")
- TextLabel90.TextColor3 = Color3.new(1, 1, 1)
- TextLabel90.TextSize = 42
- TextLabel90.TextStrokeTransparency = 0.80000001192093
- TextLabel90.TextWrap = true
- TextLabel90.TextWrapped = true
- TextLabel91.Name = "Amount"
- TextLabel91.Parent = Frame89
- TextLabel91.Size = UDim2.new(1, 0, 1, 0)
- TextLabel91.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel91.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel91.BackgroundTransparency = 1
- TextLabel91.Font = Enum.Font.Code
- TextLabel91.FontSize = Enum.FontSize.Size14
- TextLabel91.Text = "0"
- TextLabel91.TextColor = BrickColor.new("Institutional white")
- TextLabel91.TextColor3 = Color3.new(1, 1, 1)
- TextLabel91.TextScaled = true
- TextLabel91.TextSize = 14
- TextLabel91.TextWrap = true
- TextLabel91.TextWrapped = true
- ModuleScript92.Name = "GuiController"
- ModuleScript92.Parent = ScreenGui78
- table.insert(cors,sandbox(ModuleScript92,function()
- -- Gui Controller (For PC)
- -- Crazyman32
- -- January 26, 2017
- --[[
- GuiController:Start(plane)
- GuiController:Stop()
- GuiController:Update()
- GuiController:UpdateThrottle(throttle)
- GuiController:SetUsingGamepad(isUsingGamepad)
- --]]
- local GuiController = {
- UseMouse = true;
- InvertPitch = false;
- }
- local gui = script.Parent
- local plane
- local primary
- local spd, alt, throttleRT, throttleLT
- function ThrottleSetup()
- local throttle = gui:WaitForChild("Throttle")
- local grab = throttle:WaitForChild("Grab")
- local bar = throttle:WaitForChild("Bar")
- local knob = throttle:WaitForChild("Knob")
- local grabPos = grab.Position
- local grabSize = grab.Size
- function GuiController:UpdateThrottle(throttle)
- local xRatio = (throttle - 0.5) * 2
- bar.Size = UDim2.new(xRatio, 0, 1, 0)
- knob.Position = UDim2.new(xRatio, -knob.AbsoluteSize.X * xRatio, 0.5, -15)
- end
- end
- -- Toggle switch:
- function SwitchSetup(frame, defaultState, changedCallback)
- local OFF_POS = UDim2.new(0, 0, 0, 0)
- local ON_POS = UDim2.new(0.5, 0, 0, 0)
- local TWEEN_DURATION = 0.25
- local TWEEN_EASE = "Quint"
- local TWEEN_DIR = "Out"
- local switch = frame:WaitForChild("Switch")
- local slider = switch:WaitForChild("Slider")
- local sliderLbl = slider:WaitForChild("Label")
- local state = (not not defaultState) -- A funny way to cast to a boolean in Lua
- local active = false
- local function StateChanged()
- slider:TweenPosition(state and ON_POS or OFF_POS, TWEEN_DIR, TWEEN_EASE, TWEEN_DURATION, true)
- sliderLbl.Text = (state and "YES" or "NO")
- changedCallback(state)
- end
- local function Clicked()
- if (active) then return end
- active = true
- state = not state
- delay(TWEEN_DURATION, function()
- active = false
- end)
- StateChanged()
- end
- switch.MouseButton1Click:Connect(Clicked)
- StateChanged()
- end
- function GuiController:SetUsingGamepad(isUsingGamepad)
- gui.Controls.Visible = false
- gui.ControlsButton.Visible = not isUsingGamepad
- throttleRT.Text = (isUsingGamepad and "RT" or self.UseMouse and "W" or "X")
- throttleLT.Text = (isUsingGamepad and "LT" or self.UseMouse and "S" or "Z")
- end
- function GuiController:Update()
- spd.Text = tostring(math.floor(primary.Velocity.Magnitude))
- alt.Text = tostring(math.floor(primary.Position.Y))
- end
- function GuiController:Start(p)
- plane = p
- primary = plane.PrimaryPart
- ThrottleSetup()
- spd = gui:WaitForChild("Speed"):WaitForChild("Amount")
- alt = gui:WaitForChild("Altitude"):WaitForChild("Amount")
- throttleRT = gui:WaitForChild("Throttle"):WaitForChild("RT")
- throttleLT = gui:WaitForChild("Throttle"):WaitForChild("LT")
- local controls = gui:WaitForChild("Controls")
- local listKeyboard = controls:WaitForChild("ListKeyboard")
- local listKeyboardMouse = controls:WaitForChild("ListKeyboardMouse")
- controls.Visible = false
- -- ControlButton clicked:
- gui:WaitForChild("ControlsButton").MouseButton1Click:Connect(function()
- controls.Visible = not controls.Visible
- end)
- -- InvertSwitch toggled:
- SwitchSetup(controls:WaitForChild("InvertSwitch"), self.InvertPitch, function(inverted)
- self.InvertPitch = inverted
- end)
- -- MouseSwitch toggled:
- SwitchSetup(controls:WaitForChild("MouseSwitch"), self.UseMouse, function(useMouse)
- self.UseMouse = useMouse
- listKeyboard.Visible = not useMouse
- listKeyboardMouse.Visible = useMouse
- throttleRT.Text = (useMouse and "W" or "X")
- throttleLT.Text = (useMouse and "S" or "Z")
- end)
- -- Control Exit clicked:
- controls:WaitForChild("Exit").MouseButton1Click:Connect(function()
- controls.Visible = false
- end)
- end
- function GuiController:Stop()
- end
- return GuiController
- end))
- TextButton93.Name = "ControlsButton"
- TextButton93.Parent = ScreenGui78
- TextButton93.Position = UDim2.new(1, -230, 1, -30)
- TextButton93.Size = UDim2.new(0, 200, 0, -40)
- TextButton93.BackgroundColor = BrickColor.new("Institutional white")
- TextButton93.BackgroundColor3 = Color3.new(1, 1, 1)
- TextButton93.BorderSizePixel = 0
- TextButton93.Font = Enum.Font.SourceSansBold
- TextButton93.FontSize = Enum.FontSize.Size36
- TextButton93.Text = "CONTROLS"
- TextButton93.TextColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- TextButton93.TextSize = 36
- Frame94.Name = "Controls"
- Frame94.Parent = ScreenGui78
- Frame94.Position = UDim2.new(0.5, 0, 0, 30)
- Frame94.Visible = false
- Frame94.Size = UDim2.new(0, 400, 0, 300)
- Frame94.Active = true
- Frame94.AnchorPoint = Vector2.new(0.5, 0)
- Frame94.BackgroundColor = BrickColor.new("Black")
- Frame94.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame94.Draggable = true
- TextLabel95.Name = "Title"
- TextLabel95.Parent = Frame94
- TextLabel95.Size = UDim2.new(1, 0, 0, 30)
- TextLabel95.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel95.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel95.BackgroundTransparency = 1
- TextLabel95.Font = Enum.Font.SourceSansBold
- TextLabel95.FontSize = Enum.FontSize.Size36
- TextLabel95.Text = "CONTROLS"
- TextLabel95.TextColor = BrickColor.new("Institutional white")
- TextLabel95.TextColor3 = Color3.new(1, 1, 1)
- TextLabel95.TextSize = 36
- TextButton96.Name = "Exit"
- TextButton96.Parent = Frame94
- TextButton96.Position = UDim2.new(1, 5, 0, -5)
- TextButton96.Size = UDim2.new(0, -30, 0, 30)
- TextButton96.BackgroundColor = BrickColor.new("Institutional white")
- TextButton96.BackgroundColor3 = Color3.new(1, 1, 1)
- TextButton96.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- TextButton96.BorderSizePixel = 2
- TextButton96.Font = Enum.Font.SourceSansBold
- TextButton96.FontSize = Enum.FontSize.Size36
- TextButton96.Text = "X"
- TextButton96.TextColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- TextButton96.TextSize = 36
- Frame97.Name = "ListKeyboardMouse"
- Frame97.Parent = Frame94
- Frame97.Position = UDim2.new(0, 10, 0, 40)
- Frame97.Visible = false
- Frame97.Size = UDim2.new(1, -20, 1, -100)
- Frame97.BackgroundColor = BrickColor.new("Institutional white")
- Frame97.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame97.BackgroundTransparency = 1
- Frame98.Name = "Control01"
- Frame98.Parent = Frame97
- Frame98.Size = UDim2.new(1, 0, 0, 30)
- Frame98.BackgroundColor = BrickColor.new("Institutional white")
- Frame98.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame98.BackgroundTransparency = 1
- TextLabel99.Name = "Label"
- TextLabel99.Parent = Frame98
- TextLabel99.Size = UDim2.new(1, 0, 1, 0)
- TextLabel99.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel99.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel99.BackgroundTransparency = 1
- TextLabel99.Font = Enum.Font.SourceSans
- TextLabel99.FontSize = Enum.FontSize.Size28
- TextLabel99.Text = "Pitch & Roll"
- TextLabel99.TextColor = BrickColor.new("Institutional white")
- TextLabel99.TextColor3 = Color3.new(1, 1, 1)
- TextLabel99.TextSize = 28
- TextLabel99.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel100.Name = "Control"
- TextLabel100.Parent = Frame98
- TextLabel100.Size = UDim2.new(1, 0, 1, 0)
- TextLabel100.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel100.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel100.BackgroundTransparency = 1
- TextLabel100.Font = Enum.Font.SourceSans
- TextLabel100.FontSize = Enum.FontSize.Size28
- TextLabel100.Text = "Mouse"
- TextLabel100.TextColor = BrickColor.new("Institutional white")
- TextLabel100.TextColor3 = Color3.new(1, 1, 1)
- TextLabel100.TextSize = 28
- TextLabel100.TextXAlignment = Enum.TextXAlignment.Right
- Frame101.Name = "Divider"
- Frame101.Parent = Frame98
- Frame101.Position = UDim2.new(0, 0, 1, 0)
- Frame101.Size = UDim2.new(1, 0, 0, 1)
- Frame101.BackgroundColor = BrickColor.new("Sand red")
- Frame101.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- Frame101.BorderSizePixel = 0
- Frame102.Name = "Control02"
- Frame102.Parent = Frame97
- Frame102.Position = UDim2.new(0, 0, 0, 30)
- Frame102.Size = UDim2.new(1, 0, 0, 30)
- Frame102.BackgroundColor = BrickColor.new("Institutional white")
- Frame102.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame102.BackgroundTransparency = 1
- TextLabel103.Name = "Label"
- TextLabel103.Parent = Frame102
- TextLabel103.Size = UDim2.new(1, 0, 1, 0)
- TextLabel103.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel103.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel103.BackgroundTransparency = 1
- TextLabel103.Font = Enum.Font.SourceSans
- TextLabel103.FontSize = Enum.FontSize.Size28
- TextLabel103.Text = "Yaw (Rudder)"
- TextLabel103.TextColor = BrickColor.new("Institutional white")
- TextLabel103.TextColor3 = Color3.new(1, 1, 1)
- TextLabel103.TextSize = 28
- TextLabel103.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel104.Name = "Control"
- TextLabel104.Parent = Frame102
- TextLabel104.Size = UDim2.new(1, 0, 1, 0)
- TextLabel104.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel104.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel104.BackgroundTransparency = 1
- TextLabel104.Font = Enum.Font.SourceSans
- TextLabel104.FontSize = Enum.FontSize.Size28
- TextLabel104.Text = "A & D"
- TextLabel104.TextColor = BrickColor.new("Institutional white")
- TextLabel104.TextColor3 = Color3.new(1, 1, 1)
- TextLabel104.TextSize = 28
- TextLabel104.TextXAlignment = Enum.TextXAlignment.Right
- Frame105.Name = "Divider"
- Frame105.Parent = Frame102
- Frame105.Position = UDim2.new(0, 0, 1, 0)
- Frame105.Size = UDim2.new(1, 0, 0, 1)
- Frame105.BackgroundColor = BrickColor.new("Sand red")
- Frame105.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- Frame105.BorderSizePixel = 0
- Frame106.Name = "Control03"
- Frame106.Parent = Frame97
- Frame106.Position = UDim2.new(0, 0, 0, 60)
- Frame106.Size = UDim2.new(1, 0, 0, 30)
- Frame106.BackgroundColor = BrickColor.new("Institutional white")
- Frame106.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame106.BackgroundTransparency = 1
- TextLabel107.Name = "Label"
- TextLabel107.Parent = Frame106
- TextLabel107.Size = UDim2.new(1, 0, 1, 0)
- TextLabel107.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel107.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel107.BackgroundTransparency = 1
- TextLabel107.Font = Enum.Font.SourceSans
- TextLabel107.FontSize = Enum.FontSize.Size28
- TextLabel107.Text = "Throttle"
- TextLabel107.TextColor = BrickColor.new("Institutional white")
- TextLabel107.TextColor3 = Color3.new(1, 1, 1)
- TextLabel107.TextSize = 28
- TextLabel107.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel108.Name = "Control"
- TextLabel108.Parent = Frame106
- TextLabel108.Size = UDim2.new(1, 0, 1, 0)
- TextLabel108.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel108.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel108.BackgroundTransparency = 1
- TextLabel108.Font = Enum.Font.SourceSans
- TextLabel108.FontSize = Enum.FontSize.Size28
- TextLabel108.Text = "W & S"
- TextLabel108.TextColor = BrickColor.new("Institutional white")
- TextLabel108.TextColor3 = Color3.new(1, 1, 1)
- TextLabel108.TextSize = 28
- TextLabel108.TextXAlignment = Enum.TextXAlignment.Right
- Frame109.Name = "Divider"
- Frame109.Parent = Frame106
- Frame109.Position = UDim2.new(0, 0, 1, 0)
- Frame109.Size = UDim2.new(1, 0, 0, 1)
- Frame109.BackgroundColor = BrickColor.new("Sand red")
- Frame109.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- Frame109.BorderSizePixel = 0
- Frame110.Name = "Control04"
- Frame110.Parent = Frame97
- Frame110.Position = UDim2.new(0, 0, 0, 90)
- Frame110.Size = UDim2.new(1, 0, 0, 30)
- Frame110.BackgroundColor = BrickColor.new("Institutional white")
- Frame110.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame110.BackgroundTransparency = 1
- TextLabel111.Name = "Label"
- TextLabel111.Parent = Frame110
- TextLabel111.Size = UDim2.new(1, 0, 1, 0)
- TextLabel111.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel111.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel111.BackgroundTransparency = 1
- TextLabel111.Font = Enum.Font.SourceSans
- TextLabel111.FontSize = Enum.FontSize.Size28
- TextLabel111.Text = "Camera View"
- TextLabel111.TextColor = BrickColor.new("Institutional white")
- TextLabel111.TextColor3 = Color3.new(1, 1, 1)
- TextLabel111.TextSize = 28
- TextLabel111.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel112.Name = "Control"
- TextLabel112.Parent = Frame110
- TextLabel112.Size = UDim2.new(1, 0, 1, 0)
- TextLabel112.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel112.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel112.BackgroundTransparency = 1
- TextLabel112.Font = Enum.Font.SourceSans
- TextLabel112.FontSize = Enum.FontSize.Size28
- TextLabel112.Text = "C"
- TextLabel112.TextColor = BrickColor.new("Institutional white")
- TextLabel112.TextColor3 = Color3.new(1, 1, 1)
- TextLabel112.TextSize = 28
- TextLabel112.TextXAlignment = Enum.TextXAlignment.Right
- Frame113.Name = "Divider"
- Frame113.Parent = Frame110
- Frame113.Position = UDim2.new(0, 0, 1, 0)
- Frame113.Size = UDim2.new(1, 0, 0, 1)
- Frame113.BackgroundColor = BrickColor.new("Sand red")
- Frame113.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- Frame113.BorderSizePixel = 0
- Frame114.Name = "MouseSwitch"
- Frame114.Parent = Frame94
- Frame114.Position = UDim2.new(0, 10, 1, -10)
- Frame114.Size = UDim2.new(1, -20, 0, -40)
- Frame114.BackgroundColor = BrickColor.new("Institutional white")
- Frame114.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame114.BackgroundTransparency = 1
- TextLabel115.Name = "Label"
- TextLabel115.Parent = Frame114
- TextLabel115.Size = UDim2.new(1, 0, 1, 0)
- TextLabel115.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel115.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel115.BackgroundTransparency = 1
- TextLabel115.Font = Enum.Font.SourceSans
- TextLabel115.FontSize = Enum.FontSize.Size24
- TextLabel115.Text = "Use Mouse:"
- TextLabel115.TextColor = BrickColor.new("Institutional white")
- TextLabel115.TextColor3 = Color3.new(1, 1, 1)
- TextLabel115.TextSize = 24
- TextLabel115.TextXAlignment = Enum.TextXAlignment.Left
- TextButton116.Name = "Switch"
- TextButton116.Parent = Frame114
- TextButton116.Position = UDim2.new(1, 0, 0, 0)
- TextButton116.Size = UDim2.new(-0.5, 0, 1, 0)
- TextButton116.BackgroundColor = BrickColor.new("Institutional white")
- TextButton116.BackgroundColor3 = Color3.new(1, 1, 1)
- TextButton116.BorderSizePixel = 0
- TextButton116.Font = Enum.Font.SourceSans
- TextButton116.FontSize = Enum.FontSize.Size14
- TextButton116.Text = ""
- TextButton116.TextSize = 14
- TextButton116.TextTransparency = 1
- Frame117.Name = "Slider"
- Frame117.Parent = TextButton116
- Frame117.Size = UDim2.new(0.5, 0, 1, 0)
- Frame117.BackgroundColor = BrickColor.new("Institutional white")
- Frame117.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame117.BackgroundTransparency = 1
- Frame117.BorderSizePixel = 0
- TextLabel118.Name = "Label"
- TextLabel118.Parent = Frame117
- TextLabel118.Position = UDim2.new(0, 5, 0, 5)
- TextLabel118.Size = UDim2.new(1, -10, 1, -10)
- TextLabel118.BackgroundColor = BrickColor.new("Sand red")
- TextLabel118.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- TextLabel118.BorderSizePixel = 0
- TextLabel118.Font = Enum.Font.SourceSansBold
- TextLabel118.FontSize = Enum.FontSize.Size24
- TextLabel118.Text = "YES"
- TextLabel118.TextColor = BrickColor.new("Institutional white")
- TextLabel118.TextColor3 = Color3.new(1, 1, 1)
- TextLabel118.TextSize = 24
- Frame119.Name = "ListKeyboard"
- Frame119.Parent = Frame94
- Frame119.Position = UDim2.new(0, 10, 0, 40)
- Frame119.Size = UDim2.new(1, -20, 1, -100)
- Frame119.BackgroundColor = BrickColor.new("Institutional white")
- Frame119.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame119.BackgroundTransparency = 1
- Frame120.Name = "Control01"
- Frame120.Parent = Frame119
- Frame120.Size = UDim2.new(1, 0, 0, 30)
- Frame120.BackgroundColor = BrickColor.new("Institutional white")
- Frame120.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame120.BackgroundTransparency = 1
- TextLabel121.Name = "Label"
- TextLabel121.Parent = Frame120
- TextLabel121.Size = UDim2.new(1, 0, 1, 0)
- TextLabel121.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel121.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel121.BackgroundTransparency = 1
- TextLabel121.Font = Enum.Font.SourceSans
- TextLabel121.FontSize = Enum.FontSize.Size28
- TextLabel121.Text = "Pitch & Roll"
- TextLabel121.TextColor = BrickColor.new("Institutional white")
- TextLabel121.TextColor3 = Color3.new(1, 1, 1)
- TextLabel121.TextSize = 28
- TextLabel121.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel122.Name = "Control"
- TextLabel122.Parent = Frame120
- TextLabel122.Size = UDim2.new(1, 0, 1, 0)
- TextLabel122.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel122.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel122.BackgroundTransparency = 1
- TextLabel122.Font = Enum.Font.SourceSans
- TextLabel122.FontSize = Enum.FontSize.Size28
- TextLabel122.Text = "WASD"
- TextLabel122.TextColor = BrickColor.new("Institutional white")
- TextLabel122.TextColor3 = Color3.new(1, 1, 1)
- TextLabel122.TextSize = 28
- TextLabel122.TextXAlignment = Enum.TextXAlignment.Right
- Frame123.Name = "Divider"
- Frame123.Parent = Frame120
- Frame123.Position = UDim2.new(0, 0, 1, 0)
- Frame123.Size = UDim2.new(1, 0, 0, 1)
- Frame123.BackgroundColor = BrickColor.new("Sand red")
- Frame123.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- Frame123.BorderSizePixel = 0
- Frame124.Name = "Control02"
- Frame124.Parent = Frame119
- Frame124.Position = UDim2.new(0, 0, 0, 30)
- Frame124.Size = UDim2.new(1, 0, 0, 30)
- Frame124.BackgroundColor = BrickColor.new("Institutional white")
- Frame124.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame124.BackgroundTransparency = 1
- TextLabel125.Name = "Label"
- TextLabel125.Parent = Frame124
- TextLabel125.Size = UDim2.new(1, 0, 1, 0)
- TextLabel125.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel125.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel125.BackgroundTransparency = 1
- TextLabel125.Font = Enum.Font.SourceSans
- TextLabel125.FontSize = Enum.FontSize.Size28
- TextLabel125.Text = "Yaw (Rudder)"
- TextLabel125.TextColor = BrickColor.new("Institutional white")
- TextLabel125.TextColor3 = Color3.new(1, 1, 1)
- TextLabel125.TextSize = 28
- TextLabel125.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel126.Name = "Control"
- TextLabel126.Parent = Frame124
- TextLabel126.Size = UDim2.new(1, 0, 1, 0)
- TextLabel126.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel126.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel126.BackgroundTransparency = 1
- TextLabel126.Font = Enum.Font.SourceSans
- TextLabel126.FontSize = Enum.FontSize.Size28
- TextLabel126.Text = "Q & E"
- TextLabel126.TextColor = BrickColor.new("Institutional white")
- TextLabel126.TextColor3 = Color3.new(1, 1, 1)
- TextLabel126.TextSize = 28
- TextLabel126.TextXAlignment = Enum.TextXAlignment.Right
- Frame127.Name = "Divider"
- Frame127.Parent = Frame124
- Frame127.Position = UDim2.new(0, 0, 1, 0)
- Frame127.Size = UDim2.new(1, 0, 0, 1)
- Frame127.BackgroundColor = BrickColor.new("Sand red")
- Frame127.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- Frame127.BorderSizePixel = 0
- Frame128.Name = "Control03"
- Frame128.Parent = Frame119
- Frame128.Position = UDim2.new(0, 0, 0, 60)
- Frame128.Size = UDim2.new(1, 0, 0, 30)
- Frame128.BackgroundColor = BrickColor.new("Institutional white")
- Frame128.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame128.BackgroundTransparency = 1
- TextLabel129.Name = "Label"
- TextLabel129.Parent = Frame128
- TextLabel129.Size = UDim2.new(1, 0, 1, 0)
- TextLabel129.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel129.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel129.BackgroundTransparency = 1
- TextLabel129.Font = Enum.Font.SourceSans
- TextLabel129.FontSize = Enum.FontSize.Size28
- TextLabel129.Text = "Throttle"
- TextLabel129.TextColor = BrickColor.new("Institutional white")
- TextLabel129.TextColor3 = Color3.new(1, 1, 1)
- TextLabel129.TextSize = 28
- TextLabel129.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel130.Name = "Control"
- TextLabel130.Parent = Frame128
- TextLabel130.Size = UDim2.new(1, 0, 1, 0)
- TextLabel130.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel130.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel130.BackgroundTransparency = 1
- TextLabel130.Font = Enum.Font.SourceSans
- TextLabel130.FontSize = Enum.FontSize.Size28
- TextLabel130.Text = "Z & X"
- TextLabel130.TextColor = BrickColor.new("Institutional white")
- TextLabel130.TextColor3 = Color3.new(1, 1, 1)
- TextLabel130.TextSize = 28
- TextLabel130.TextXAlignment = Enum.TextXAlignment.Right
- Frame131.Name = "Divider"
- Frame131.Parent = Frame128
- Frame131.Position = UDim2.new(0, 0, 1, 0)
- Frame131.Size = UDim2.new(1, 0, 0, 1)
- Frame131.BackgroundColor = BrickColor.new("Sand red")
- Frame131.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- Frame131.BorderSizePixel = 0
- Frame132.Name = "Control04"
- Frame132.Parent = Frame119
- Frame132.Position = UDim2.new(0, 0, 0, 90)
- Frame132.Size = UDim2.new(1, 0, 0, 30)
- Frame132.BackgroundColor = BrickColor.new("Institutional white")
- Frame132.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame132.BackgroundTransparency = 1
- TextLabel133.Name = "Label"
- TextLabel133.Parent = Frame132
- TextLabel133.Size = UDim2.new(1, 0, 1, 0)
- TextLabel133.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel133.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel133.BackgroundTransparency = 1
- TextLabel133.Font = Enum.Font.SourceSans
- TextLabel133.FontSize = Enum.FontSize.Size28
- TextLabel133.Text = "Camera View"
- TextLabel133.TextColor = BrickColor.new("Institutional white")
- TextLabel133.TextColor3 = Color3.new(1, 1, 1)
- TextLabel133.TextSize = 28
- TextLabel133.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel134.Name = "Control"
- TextLabel134.Parent = Frame132
- TextLabel134.Size = UDim2.new(1, 0, 1, 0)
- TextLabel134.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel134.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel134.BackgroundTransparency = 1
- TextLabel134.Font = Enum.Font.SourceSans
- TextLabel134.FontSize = Enum.FontSize.Size28
- TextLabel134.Text = "C"
- TextLabel134.TextColor = BrickColor.new("Institutional white")
- TextLabel134.TextColor3 = Color3.new(1, 1, 1)
- TextLabel134.TextSize = 28
- TextLabel134.TextXAlignment = Enum.TextXAlignment.Right
- Frame135.Name = "Divider"
- Frame135.Parent = Frame132
- Frame135.Position = UDim2.new(0, 0, 1, 0)
- Frame135.Size = UDim2.new(1, 0, 0, 1)
- Frame135.BackgroundColor = BrickColor.new("Sand red")
- Frame135.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- Frame135.BorderSizePixel = 0
- Frame136.Name = "InvertSwitch"
- Frame136.Parent = Frame94
- Frame136.Position = UDim2.new(0, 10, 1, -60)
- Frame136.Size = UDim2.new(1, -20, 0, -40)
- Frame136.BackgroundColor = BrickColor.new("Institutional white")
- Frame136.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame136.BackgroundTransparency = 1
- TextLabel137.Name = "Label"
- TextLabel137.Parent = Frame136
- TextLabel137.Size = UDim2.new(1, 0, 1, 0)
- TextLabel137.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel137.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel137.BackgroundTransparency = 1
- TextLabel137.Font = Enum.Font.SourceSans
- TextLabel137.FontSize = Enum.FontSize.Size24
- TextLabel137.Text = "Invert Pitch:"
- TextLabel137.TextColor = BrickColor.new("Institutional white")
- TextLabel137.TextColor3 = Color3.new(1, 1, 1)
- TextLabel137.TextSize = 24
- TextLabel137.TextXAlignment = Enum.TextXAlignment.Left
- TextButton138.Name = "Switch"
- TextButton138.Parent = Frame136
- TextButton138.Position = UDim2.new(1, 0, 0, 0)
- TextButton138.Size = UDim2.new(-0.5, 0, 1, 0)
- TextButton138.BackgroundColor = BrickColor.new("Institutional white")
- TextButton138.BackgroundColor3 = Color3.new(1, 1, 1)
- TextButton138.BorderSizePixel = 0
- TextButton138.Font = Enum.Font.SourceSans
- TextButton138.FontSize = Enum.FontSize.Size14
- TextButton138.Text = ""
- TextButton138.TextSize = 14
- TextButton138.TextTransparency = 1
- Frame139.Name = "Slider"
- Frame139.Parent = TextButton138
- Frame139.Position = UDim2.new(0.5, 0, 0, 0)
- Frame139.Size = UDim2.new(0.5, 0, 1, 0)
- Frame139.BackgroundColor = BrickColor.new("Institutional white")
- Frame139.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame139.BackgroundTransparency = 1
- Frame139.BorderSizePixel = 0
- TextLabel140.Name = "Label"
- TextLabel140.Parent = Frame139
- TextLabel140.Position = UDim2.new(0, 5, 0, 5)
- TextLabel140.Size = UDim2.new(1, -10, 1, -10)
- TextLabel140.BackgroundColor = BrickColor.new("Sand red")
- TextLabel140.BackgroundColor3 = Color3.new(0.470588, 0.470588, 0.470588)
- TextLabel140.BorderSizePixel = 0
- TextLabel140.Font = Enum.Font.SourceSansBold
- TextLabel140.FontSize = Enum.FontSize.Size24
- TextLabel140.Text = "NO"
- TextLabel140.TextColor = BrickColor.new("Institutional white")
- TextLabel140.TextColor3 = Color3.new(1, 1, 1)
- TextLabel140.TextSize = 24
- ScreenGui141.Name = "PlaneMobileGui"
- ScreenGui141.Parent = LocalScript50
- Frame142.Name = "Throttle"
- Frame142.Parent = ScreenGui141
- Frame142.Position = UDim2.new(0.5, 0, 1, -90)
- Frame142.Size = UDim2.new(0, 200, 0, -10)
- Frame142.AnchorPoint = Vector2.new(0.5, 0)
- Frame142.BackgroundColor = BrickColor.new("Black")
- Frame142.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame142.BackgroundTransparency = 0.5
- Frame142.BorderSizePixel = 0
- TextLabel143.Name = "Label"
- TextLabel143.Parent = Frame142
- TextLabel143.Position = UDim2.new(0, 0, 0, -13)
- TextLabel143.Size = UDim2.new(1, 0, 0, -20)
- TextLabel143.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel143.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel143.BackgroundTransparency = 1
- TextLabel143.Font = Enum.Font.SourceSansBold
- TextLabel143.FontSize = Enum.FontSize.Size24
- TextLabel143.Text = "THROTTLE"
- TextLabel143.TextColor = BrickColor.new("Institutional white")
- TextLabel143.TextColor3 = Color3.new(1, 1, 1)
- TextLabel143.TextSize = 24
- TextLabel143.TextStrokeTransparency = 0.80000001192093
- Frame144.Name = "Knob"
- Frame144.Parent = Frame142
- Frame144.Position = UDim2.new(0, 0, 0.5, -15)
- Frame144.Size = UDim2.new(0, 20, 0, 30)
- Frame144.BackgroundColor = BrickColor.new("Institutional white")
- Frame144.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame144.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame144.BorderSizePixel = 2
- Frame144.ZIndex = 2
- Frame145.Name = "Bar"
- Frame145.Parent = Frame142
- Frame145.Size = UDim2.new(0, 0, 1, 0)
- Frame145.BackgroundColor = BrickColor.new("Institutional white")
- Frame145.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame145.BorderColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame145.BorderSizePixel = 2
- TextButton146.Name = "Grab"
- TextButton146.Parent = Frame142
- TextButton146.Position = UDim2.new(0, -10, 0, -15)
- TextButton146.Size = UDim2.new(1, 20, 1, 30)
- TextButton146.BackgroundColor = BrickColor.new("Really red")
- TextButton146.BackgroundColor3 = Color3.new(1, 0, 0)
- TextButton146.BackgroundTransparency = 1
- TextButton146.ZIndex = 3
- TextButton146.Font = Enum.Font.SourceSans
- TextButton146.FontSize = Enum.FontSize.Size14
- TextButton146.Text = ""
- TextButton146.TextSize = 14
- Frame147.Name = "Speed"
- Frame147.Parent = ScreenGui141
- Frame147.Position = UDim2.new(0.5, -10, 1, -20)
- Frame147.Size = UDim2.new(0, 100, 0, -30)
- Frame147.AnchorPoint = Vector2.new(1, 0)
- Frame147.BackgroundColor = BrickColor.new("Black")
- Frame147.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame147.BackgroundTransparency = 0.5
- Frame147.BorderSizePixel = 0
- TextLabel148.Name = "Label"
- TextLabel148.Parent = Frame147
- TextLabel148.Position = UDim2.new(0, 0, 0, -3)
- TextLabel148.Size = UDim2.new(1, 0, 0, -20)
- TextLabel148.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel148.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel148.BackgroundTransparency = 1
- TextLabel148.Font = Enum.Font.SourceSansBold
- TextLabel148.FontSize = Enum.FontSize.Size24
- TextLabel148.Text = "SPEED"
- TextLabel148.TextColor = BrickColor.new("Institutional white")
- TextLabel148.TextColor3 = Color3.new(1, 1, 1)
- TextLabel148.TextSize = 24
- TextLabel148.TextStrokeTransparency = 0.80000001192093
- TextLabel149.Name = "Amount"
- TextLabel149.Parent = Frame147
- TextLabel149.Size = UDim2.new(1, 0, 1, 0)
- TextLabel149.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel149.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel149.BackgroundTransparency = 1
- TextLabel149.Font = Enum.Font.Code
- TextLabel149.FontSize = Enum.FontSize.Size14
- TextLabel149.Text = "0"
- TextLabel149.TextColor = BrickColor.new("Institutional white")
- TextLabel149.TextColor3 = Color3.new(1, 1, 1)
- TextLabel149.TextScaled = true
- TextLabel149.TextSize = 14
- TextLabel149.TextWrap = true
- TextLabel149.TextWrapped = true
- Frame150.Name = "Altitude"
- Frame150.Parent = ScreenGui141
- Frame150.Position = UDim2.new(0.5, 10, 1, -20)
- Frame150.Size = UDim2.new(0, 100, 0, -30)
- Frame150.BackgroundColor = BrickColor.new("Black")
- Frame150.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame150.BackgroundTransparency = 0.5
- Frame150.BorderSizePixel = 0
- TextLabel151.Name = "Label"
- TextLabel151.Parent = Frame150
- TextLabel151.Position = UDim2.new(0, 0, 0, -3)
- TextLabel151.Size = UDim2.new(1, 0, 0, -20)
- TextLabel151.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel151.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel151.BackgroundTransparency = 1
- TextLabel151.Font = Enum.Font.SourceSansBold
- TextLabel151.FontSize = Enum.FontSize.Size24
- TextLabel151.Text = "ALTITUDE"
- TextLabel151.TextColor = BrickColor.new("Institutional white")
- TextLabel151.TextColor3 = Color3.new(1, 1, 1)
- TextLabel151.TextSize = 24
- TextLabel151.TextStrokeTransparency = 0.80000001192093
- TextLabel152.Name = "Amount"
- TextLabel152.Parent = Frame150
- TextLabel152.Size = UDim2.new(1, 0, 1, 0)
- TextLabel152.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel152.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel152.BackgroundTransparency = 1
- TextLabel152.Font = Enum.Font.Code
- TextLabel152.FontSize = Enum.FontSize.Size14
- TextLabel152.Text = "0"
- TextLabel152.TextColor = BrickColor.new("Institutional white")
- TextLabel152.TextColor3 = Color3.new(1, 1, 1)
- TextLabel152.TextScaled = true
- TextLabel152.TextSize = 14
- TextLabel152.TextWrap = true
- TextLabel152.TextWrapped = true
- ModuleScript153.Name = "GuiController"
- ModuleScript153.Parent = ScreenGui141
- table.insert(cors,sandbox(ModuleScript153,function()
- -- Gui Controller (For mobile)
- -- Crazyman32
- -- January 26, 2017
- local GuiController = {
- Throttle = 0;
- Bank = 0;
- Pitch = 0;
- Yaw = 0;
- ViewX = 0;
- ViewY = 0;
- SwitchView = false;
- Exit = false;
- }
- -- Mobile controls are sensitive! Control inputs are multiplied by
- -- this number to help make flying a bit easier on mobile:
- local CONTROL_INPUT_REDUCTION = 0.5
- local VIEW_PAN_MULTIPLIER = 0.005
- local userInput = game:GetService("UserInputService")
- local gui = script.Parent
- local plane
- local primary
- local spd, alt
- function ThrottleSetup()
- local throttle = gui:WaitForChild("Throttle")
- local grab = throttle:WaitForChild("Grab")
- local bar = throttle:WaitForChild("Bar")
- local knob = throttle:WaitForChild("Knob")
- local grabPos = grab.Position
- local grabSize = grab.Size
- local grabDown = false
- grab.InputChanged:Connect(function(input)
- if (grabDown and input.UserInputType == Enum.UserInputType.Touch) then
- local x = input.Position.X
- local xRatio = (x - throttle.AbsolutePosition.X) / throttle.AbsoluteSize.X
- xRatio = (xRatio < 0 and 0 or xRatio > 1 and 1 or xRatio)
- GuiController.Throttle = xRatio
- bar.Size = UDim2.new(xRatio, 0, 1, 0)
- knob.Position = UDim2.new(xRatio, -knob.AbsoluteSize.X * xRatio, 0.5, -15)
- end
- end)
- grab.MouseButton1Down:Connect(function()
- grabDown = true
- end)
- userInput.InputEnded:Connect(function(input)
- if (input.UserInputType == Enum.UserInputType.Touch) then
- grabDown = false
- end
- end)
- end
- -- Set up an on-screen thumbstick control:
- function ThumbstickSetup(frame, callback)
- local stick = frame:WaitForChild("Stick")
- local btn = frame:WaitForChild("Button")
- local btnDown = false
- -- Calculate relative position of thumbstick when dragged to screen position "pos":
- local function TouchDragged(pos)
- local x = (pos.X - frame.AbsolutePosition.X)
- local y = (pos.Y - frame.AbsolutePosition.Y)
- x = (x < 0 and 0 or x > frame.AbsoluteSize.X and frame.AbsoluteSize.X or x)
- y = (y < 0 and 0 or y > frame.AbsoluteSize.Y and frame.AbsoluteSize.Y or y)
- local ratioX = ((x / frame.AbsoluteSize.X) - 0.5) * 2
- local ratioY = -((y / frame.AbsoluteSize.Y) - 0.5) * 2
- stick.Position = UDim2.new(0, x, 0, y)
- callback(ratioX, ratioY)
- end
- local function StartTouch(pos)
- btnDown = true
- TouchDragged(pos)
- btn.Size = UDim2.new(10, 0, 10, 0)
- end
- local function StopTouch(pos)
- btnDown = false
- stick:TweenPosition(UDim2.new(0.5, 0, 0.5, 0), "Out", "Quint", 0.15, true)
- btn.Size = UDim2.new(1, 0, 1, 0)
- callback(0, 0)
- end
- btn.InputChanged:Connect(function(input)
- if (btnDown and input.UserInputType == Enum.UserInputType.Touch) then
- TouchDragged(input.Position)
- end
- end)
- btn.MouseButton1Down:Connect(function(x, y)
- StartTouch(Vector3.new(x, y, 0))
- end)
- btn.InputEnded:Connect(function(input)
- if (input.UserInputType == Enum.UserInputType.Touch) then
- StopTouch(input.Position)
- end
- end)
- end
- function GuiController:Update()
- spd.Text = tostring(math.floor(primary.Velocity.Magnitude))
- alt.Text = tostring(math.floor(primary.Position.Y))
- end
- function GuiController:Start(p)
- plane = p
- primary = plane.PrimaryPart
- ThrottleSetup()
- spd = gui:WaitForChild("Speed"):WaitForChild("Amount")
- alt = gui:WaitForChild("Altitude"):WaitForChild("Amount")
- local touchingScreen = false
- local lastTouchPos
- -- Yaw thumbstick:
- ThumbstickSetup(gui:WaitForChild("ThumbstickLeft"), function(x, y)
- self.Yaw = x
- end)
- -- Maneuver thumbstick:
- ThumbstickSetup(gui:WaitForChild("ThumbstickRight"), function(x, y)
- self.Bank = x * CONTROL_INPUT_REDUCTION
- self.Pitch = y * CONTROL_INPUT_REDUCTION
- end)
- -- Pan view when dragging finger across screen:
- userInput.TouchMoved:Connect(function(inputObject, processed)
- if (not touchingScreen) then return end
- local pos = inputObject.Position
- local deltaPos = (pos - lastTouchPos)
- local x = (self.ViewX - (deltaPos.X * VIEW_PAN_MULTIPLIER))
- local y = (self.ViewY - (deltaPos.Y * VIEW_PAN_MULTIPLIER))
- self.ViewX = (x < -1 and -1 or x > 1 and 1 or x)
- self.ViewY = (y < -1 and -1 or y > 1 and 1 or y)
- lastTouchPos = pos
- end)
- -- Start panning:
- userInput.TouchStarted:Connect(function(inputObject, processed)
- if (processed) then return end
- touchingScreen = true
- lastTouchPos = inputObject.Position
- end)
- -- Stop panning:
- userInput.TouchEnded:Connect(function(inputObject, processed)
- touchingScreen = false
- end)
- -- Change view:
- gui:WaitForChild("ChangeView").MouseButton1Click:Connect(function()
- self.SwitchView = true
- end)
- -- Exit plane:
- gui:WaitForChild("Exit").MouseButton1Click:Connect(function()
- self.Exit = true
- end)
- end
- function GuiController:Stop()
- end
- return GuiController
- end))
- Frame154.Name = "ThumbstickLeft"
- Frame154.Parent = ScreenGui141
- Frame154.Position = UDim2.new(0, 20, 1, -140)
- Frame154.Size = UDim2.new(0, 120, 0, 120)
- Frame154.BackgroundColor = BrickColor.new("Black")
- Frame154.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame154.BackgroundTransparency = 0.5
- Frame155.Name = "Stick"
- Frame155.Parent = Frame154
- Frame155.Position = UDim2.new(0.5, 0, 0.5, 0)
- Frame155.Size = UDim2.new(0.300000012, 0, 0.300000012, 0)
- Frame155.AnchorPoint = Vector2.new(0.5, 0.5)
- Frame155.BackgroundColor = BrickColor.new("Institutional white")
- Frame155.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame155.BorderSizePixel = 0
- TextButton156.Name = "Button"
- TextButton156.Parent = Frame154
- TextButton156.Position = UDim2.new(0.5, 0, 0.5, 0)
- TextButton156.Size = UDim2.new(1, 0, 1, 0)
- TextButton156.AnchorPoint = Vector2.new(0.5, 0.5)
- TextButton156.BackgroundColor = BrickColor.new("Institutional white")
- TextButton156.BackgroundColor3 = Color3.new(1, 1, 1)
- TextButton156.BackgroundTransparency = 1
- TextButton156.Font = Enum.Font.SourceSans
- TextButton156.FontSize = Enum.FontSize.Size14
- TextButton156.Text = ""
- TextButton156.TextSize = 14
- TextButton156.TextTransparency = 1
- TextLabel157.Name = "Label"
- TextLabel157.Parent = Frame154
- TextLabel157.Position = UDim2.new(0, 0, 0, -3)
- TextLabel157.Size = UDim2.new(1, 0, 0, -20)
- TextLabel157.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel157.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel157.BackgroundTransparency = 1
- TextLabel157.Font = Enum.Font.SourceSansBold
- TextLabel157.FontSize = Enum.FontSize.Size24
- TextLabel157.Text = "YAW"
- TextLabel157.TextColor = BrickColor.new("Institutional white")
- TextLabel157.TextColor3 = Color3.new(1, 1, 1)
- TextLabel157.TextSize = 24
- TextLabel157.TextStrokeTransparency = 0.80000001192093
- Frame158.Name = "ThumbstickRight"
- Frame158.Parent = ScreenGui141
- Frame158.Position = UDim2.new(1, -140, 1, -140)
- Frame158.Size = UDim2.new(0, 120, 0, 120)
- Frame158.BackgroundColor = BrickColor.new("Black")
- Frame158.BackgroundColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- Frame158.BackgroundTransparency = 0.5
- Frame159.Name = "Stick"
- Frame159.Parent = Frame158
- Frame159.Position = UDim2.new(0.5, 0, 0.5, 0)
- Frame159.Size = UDim2.new(0.300000012, 0, 0.300000012, 0)
- Frame159.AnchorPoint = Vector2.new(0.5, 0.5)
- Frame159.BackgroundColor = BrickColor.new("Institutional white")
- Frame159.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame159.BorderSizePixel = 0
- TextButton160.Name = "Button"
- TextButton160.Parent = Frame158
- TextButton160.Position = UDim2.new(0.5, 0, 0.5, 0)
- TextButton160.Size = UDim2.new(1, 0, 1, 0)
- TextButton160.AnchorPoint = Vector2.new(0.5, 0.5)
- TextButton160.BackgroundColor = BrickColor.new("Institutional white")
- TextButton160.BackgroundColor3 = Color3.new(1, 1, 1)
- TextButton160.BackgroundTransparency = 1
- TextButton160.Font = Enum.Font.SourceSans
- TextButton160.FontSize = Enum.FontSize.Size14
- TextButton160.Text = ""
- TextButton160.TextSize = 14
- TextButton160.TextTransparency = 1
- TextLabel161.Name = "Label"
- TextLabel161.Parent = Frame158
- TextLabel161.Position = UDim2.new(0, 0, 0, -3)
- TextLabel161.Size = UDim2.new(1, 0, 0, -20)
- TextLabel161.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel161.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel161.BackgroundTransparency = 1
- TextLabel161.Font = Enum.Font.SourceSansBold
- TextLabel161.FontSize = Enum.FontSize.Size24
- TextLabel161.Text = "PITCH & ROLL"
- TextLabel161.TextColor = BrickColor.new("Institutional white")
- TextLabel161.TextColor3 = Color3.new(1, 1, 1)
- TextLabel161.TextSize = 24
- TextLabel161.TextStrokeTransparency = 0.80000001192093
- TextButton162.Name = "ChangeView"
- TextButton162.Parent = ScreenGui141
- TextButton162.Position = UDim2.new(1, -20, 1, -180)
- TextButton162.Size = UDim2.new(0, -120, 0, -40)
- TextButton162.BackgroundColor = BrickColor.new("Institutional white")
- TextButton162.BackgroundColor3 = Color3.new(1, 1, 1)
- TextButton162.BackgroundTransparency = 0.5
- TextButton162.BorderSizePixel = 0
- TextButton162.Font = Enum.Font.SourceSans
- TextButton162.FontSize = Enum.FontSize.Size14
- TextButton162.Text = "VIEW"
- TextButton162.TextColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- TextButton162.TextScaled = true
- TextButton162.TextSize = 14
- TextButton162.TextWrap = true
- TextButton162.TextWrapped = true
- TextButton163.Name = "Exit"
- TextButton163.Parent = ScreenGui141
- TextButton163.Position = UDim2.new(1, -20, 0, 20)
- TextButton163.Size = UDim2.new(0, -120, 0, 40)
- TextButton163.BackgroundColor = BrickColor.new("Institutional white")
- TextButton163.BackgroundColor3 = Color3.new(1, 1, 1)
- TextButton163.BackgroundTransparency = 0.5
- TextButton163.BorderSizePixel = 0
- TextButton163.Font = Enum.Font.SourceSans
- TextButton163.FontSize = Enum.FontSize.Size14
- TextButton163.Text = "EXIT"
- TextButton163.TextColor3 = Color3.new(0.156863, 0.156863, 0.156863)
- TextButton163.TextScaled = true
- TextButton163.TextSize = 14
- TextButton163.TextWrap = true
- TextButton163.TextWrapped = true
- BoolValue164.Name = "ReadyToWeld"
- BoolValue164.Parent = Model1
- Script165.Name = "Damage"
- Script165.Parent = Model1
- table.insert(cors,sandbox(Script165,function()
- -- Damage
- -- Crazyman32
- -- January 19, 2017
- --[[
- This script handles simulating damage on the aircraft by
- listening to objects that touch the aircraft. By measuring
- the impact velocity (plane's velocity - other velocity),
- we can try to subtract health from the plane. If the health
- hits 0, the plane dies!
- To change the Max Health of the plane, change the MaxValue
- of the Health object (it's a child of this script object).
- The health will automatically be set to the MaxValue when
- this script is executed.
- --]]
- local plane = script.Parent
- while (not plane.PrimaryPart) do wait() end
- local main = plane.PrimaryPart
- local seat = plane:WaitForChild("Functional"):WaitForChild("PilotSeat")
- local lookFor = "DamageCollider"
- local health = script:WaitForChild("Health")
- health.Value = health.MaxValue
- -- Calculate damage when the magnitude of the
- -- impact is within the range of these values:
- local impactThresholdLow = 70
- local impactThresholdHigh = 500
- -- Maximum possible damage from a single impact: (In other words, if the impact hits "impactThresholdHigh", then this much damage is done)
- local maxDamage = 300
- -- Is it dead? (Don't change!)
- local dead = false
- -- When did it die? (Don't change!)
- local deadAt = 0
- -- Should the plane break into pieces next impact? (Don't change!)
- local breakPlane = false
- local listeners = {}
- function KillPlane()
- breakPlane = true
- -- Kill the pilot:
- if (seat.Occupant) then
- seat.Occupant.Health = 0
- -- Sorry pilot. Hopefully the game has respawning implemented.
- end
- main.Fire.Enabled = false
- main.Smoke.Enabled = false
- plane:BreakJoints()
- -- Play explosion. BOOM:
- if (main.Parent and main:FindFirstChild("Explosion")) then
- main.Explosion:Play()
- end
- end
- -- Listen for impact damage on the given part:
- function ListenForDamage(part)
- -- Classic debounce. If "true", then touches are "debounced", thus
- -- any impacts when this is "true" will be ignored. It is only
- -- set true for a fraction of a second after impacts:
- local debounce = false
- local listener = part.Touched:Connect(function(toucher)
- if (debounce or toucher:IsDescendantOf(plane)) then return end
- -- Measure impact force:
- local impactVelocity = (part.Velocity - toucher.Velocity).Magnitude
- if (impactVelocity > impactThresholdLow or dead) then
- if (dead) then
- -- How long it's been since the plane died and this impact occurred:
- local dur = (tick() - deadAt)
- -- My professor would yell at me for this "magic number".
- -- Coding tip: Typically you shouldn't have random numbers floating around your code like this.
- -- I'm going to not fix this just to teach you a lesson (and thanks for reading my crazy comments).
- if (dur > 0.1 and not breakPlane) then
- KillPlane()
- end
- else
- -- Calculate how much damage should be done based on the impact thresholds and the max damage allowed per impact:
- local damageRatio = (impactVelocity - impactThresholdLow) / (impactThresholdHigh - impactThresholdLow)
- local damage = (maxDamage * damageRatio)
- health.Value = (health.Value - damage)
- debounce = true
- -- Somewhat arbitrary delay (at least the amount of time is arbitrary).
- -- Don't allow any other damage until this delay function executes:
- delay(0.25, function()
- debounce = false
- end)
- end
- end
- end)
- -- Store the listener! We will want to disconnect it at some point:
- table.insert(listeners, listener)
- end
- -- Called when the health reaches 0:
- function OnDied()
- dead = true
- deadAt = tick()
- plane.Dead.Value = true
- main.Fire.Enabled = true
- main.Smoke.Enabled = true
- -- Wait a bit before forcing the plane to break into pieces:
- delay(5, function()
- if (not breakPlane) then
- KillPlane()
- end
- -- Remove the plane after a little while:
- wait(10)
- plane:Destroy()
- end)
- end
- -- Called when the health changes:
- function HealthChanged(newHealth)
- if (dead) then return end
- if (newHealth <= health.MinValue) then
- OnDied()
- end
- end
- -- Recurse through the plane to find all the parts, then hook each
- -- part up to listen for damage:
- function ScanForParts(parent)
- for _,v in pairs(parent:GetChildren()) do
- if (v:IsA("BasePart") and v:FindFirstChild(lookFor)) then
- ListenForDamage(v)
- end
- ScanForParts(v)
- end
- -- Fun fact: Recursive functions like this can be prone to "stack overflow" errors.
- -- Tail-call functions would avoid this, but (as of Feb. 2017) tailcalling is removed from Lua in ROBLOX.
- end
- ScanForParts(plane)
- health.Changed:Connect(HealthChanged)
- HealthChanged(health.Value)
- end))
- DoubleConstrainedValue166.Name = "Health"
- DoubleConstrainedValue166.Parent = Script165
- DoubleConstrainedValue166.Value = 100
- DoubleConstrainedValue166.ConstrainedValue = 100
- DoubleConstrainedValue166.MaxValue = 100
- BoolValue167.Name = "Dead"
- BoolValue167.Parent = Model1
- ModuleScript168.Name = "Flyer"
- ModuleScript168.Parent = Model1
- table.insert(cors,sandbox(ModuleScript168,function()
- -- Flyer
- -- Crazyman32
- -- January 18, 2017
- --[[
- This module is used by the Server AND the Client to simulate
- flight. This is sort-of the brain of the plane simulation,
- although the actual physics are calculated in the AirFoil
- module (a child of this module).
- The purpose of this module is to continuously update the plane
- air foils and engine based on input that is given to the plane.
- This module also updates the weld animations.
- Fields:
- (All of these are numbers between 0-1)
- Flyer.Throttle
- Flyer.BankInput
- Flyer.PitchInput
- Flyer.YawInput
- Methods:
- Flyer:Update() Update the physics (airfoils and engine force)
- Flyer:UpdateControls() Update input dampers and apply animations
- Flyer:Stop() Stop airfoils
- Flyer:Startup() Play startup sound and set initial throttle
- Flyer:Shutdown() Play shutdown sound and stop other sounds
- Flyer:ForceRealThrottle(t) Force the actual throttle (inputted Flyer.Throttle is damped; this bypasses damping)
- --]]
- local Flyer = {
- Throttle = 0;
- BankInput = 0;
- PitchInput = 0;
- YawInput = 0;
- }
- -- Max engine force and yaw force. Feel free to change these, but note
- -- that changing these could make the plane unstable. But hey, experimenting
- -- is fun! So try some different numbers. If the plane isn't taking off,
- -- then the engine force is too low.
- local MAX_ENGINE_FORCE = 300
- local MAX_YAW_FORCE = 5
- -- Note: Changing max rotation values below changes how much the control
- -- surface rotates. Because the flight physics is literally based on the
- -- orientation of those surfaces, it ALSO changes the magnitude in which
- -- those surfaces act on the flight. For example, if you set MAX_BANK to
- -- 0, then the plane won't rotate the ailerons, thus the plane can't bank.
- -- Max rotation in degrees:
- local MAX_BANK = 20
- local MAX_PITCH = 25
- local MAX_YAW = 15
- local MAX_JOYSTICK = 20
- -- Some commonly-used functions:
- local V3 = Vector3.new
- local RAD = math.rad
- local ANG = CFrame.Angles
- local AirFoil = require(script:WaitForChild("AirFoil"))
- local Damping = require(script:WaitForChild("Damping"))
- -- References to objects in the plane:
- local plane = script.Parent
- local functional = plane:WaitForChild("Functional")
- local propeller = functional:WaitForChild("Propeller")
- local tailSkid = functional:WaitForChild("TailSkid")
- local tailSkidAttachment = Instance.new("Attachment",tailSkid)
- local tailSkidThrust = Instance.new("VectorForce",tailSkid)
- tailSkidThrust.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
- tailSkidThrust.Attachment0 = tailSkidAttachment
- local controlSurfaces = functional:WaitForChild("ControlSurfaces")
- local staticAirFoils = functional:WaitForChild("StaticAirFoils")
- local animWelds = plane:WaitForChild("Welds"):WaitForChild("AnimatedWelds")
- local main = plane.PrimaryPart
- local thruster = main:WaitForChild("VectorForce")
- -- Engine sounds:
- local sStartup = main:WaitForChild("Startup")
- local sShutdown = main:WaitForChild("Shutdown")
- local sIdle = main:WaitForChild("Idle")
- local sLowThrottle = main:WaitForChild("LowThrottle")
- local sFlying = main:WaitForChild("Flying")
- -- Input dampers for silky-smooth animations:
- local controlDamp = Damping.new()
- local throttleDamp = Damping.new()
- throttleDamp.P = 1
- throttleDamp.D = 0.5
- local realThrottle = 0
- local realYaw = 0
- -- Sound ranges (sorry for making this so confusing)
- local soundRanges = {
- -- {sound, min, max, max, min, minSpeed, maxSpeed}
- {sIdle, 0.4, 0.5, 0.6, 0.8, 1.0, 2.0};
- {sLowThrottle, 0.6, 0.7, 0.8, 0.9, 0.8, 1.5};
- {sFlying, 0.7, 0.9, 1.0, 1.1, 0.8, 1.2};
- }
- local numSoundRanges = #soundRanges
- -- Calculate the volume and speed of each sound. I apologize for making
- -- this so confusing. It works how it should though.
- local function CalcSounds(throttle)
- for i = 1,numSoundRanges do
- local ranges = soundRanges[i]
- local s = ranges[1]
- -- IF Throttle >= StartMinumum AND Throttle <= EndMaximum THEN
- if (throttle >= ranges[2] and throttle <= ranges[5]) then
- -- IF Throttle < StartMaximum THEN
- if (throttle < ranges[3]) then
- -- Tween in
- s.Volume = (throttle - ranges[2]) / (ranges[3] - ranges[2])
- -- IF Throttle > EndMinimum:
- elseif (throttle > ranges[4]) then
- -- Tween out
- s.Volume = 1 - (throttle - ranges[4]) / (ranges[5] - ranges[4])
- -- ELSE (Within full-range threshold):
- else
- s.Volume = 1
- end
- -- Calculate playback speed (i.e. pitch shifting):
- local playbackRatio = (throttle - ranges[2]) / (ranges[5] - ranges[2])
- s.PlaybackSpeed = (ranges[6] + ((ranges[7] - ranges[6]) * playbackRatio))
- if (not s.IsPlaying) then
- s:Play()
- end
- elseif (s.IsPlaying) then
- s:Stop()
- end
- end
- end
- -- Get the mass of the airplane:
- local mass = 0
- do
- local function Scan(parent)
- for _,v in pairs(parent:GetChildren()) do
- if (v:IsA("BasePart")) then
- mass = (mass + v:GetMass())
- end
- Scan(v)
- end
- end
- Scan(plane)
- end
- local airFoils = {}
- -- Initialize air foils:
- do
- local function CreateAirFoil(parent, partName, overrideLift, overrideDrag)
- local part = parent:WaitForChild(partName)
- local airFoil = AirFoil.new(part, mass, overrideLift, overrideDrag)
- table.insert(airFoils, airFoil)
- end
- -- NOTE: Some are commented out since the plane seemed more unstable with them implemented!
- CreateAirFoil(controlSurfaces, "AileronBottomLeft")
- CreateAirFoil(controlSurfaces, "AileronBottomRight")
- --CreateAirFoil(controlSurfaces, "AileronTopLeft")
- --CreateAirFoil(controlSurfaces, "AileronTopRight")
- CreateAirFoil(controlSurfaces, "ElevatorLeft")
- CreateAirFoil(controlSurfaces, "ElevatorRight")
- --CreateAirFoil(controlSurfaces, "Rudder")
- --CreateAirFoil(staticAirFoils, "WingBottomLeft")
- --CreateAirFoil(staticAirFoils, "WingBottomRight")
- CreateAirFoil(staticAirFoils, "WingTop")
- CreateAirFoil(staticAirFoils, "HorizontalStabilizerLeft")
- CreateAirFoil(staticAirFoils, "HorizontalStabilizerRight")
- --CreateAirFoil(staticAirFoils, "VerticalStabilizer")
- end
- function Flyer:ForceRealThrottle(t)
- realThrottle = t
- self.Throttle = t
- throttleDamp.Position = Vector3.new(t, 0, 0)
- throttleDamp.Goal = throttleDamp.Position
- end
- --[[
- function Flyer:UpdateSound()
- CalcSounds(realThrottle)
- end
- ]]
- -- Physics updates:
- function Flyer:Update()
- -- Update all airfoils:
- for _,airFoil in pairs(airFoils) do
- airFoil:Update()
- end
- -- Update main power/thrust:
- local t = realThrottle
- if (t > 0) then
- t = math.max(0.05, (realThrottle - 0.5) * 2)
- end
- -- Apply engine thrust:
- thruster.Force = V3(0, 0, t * mass * -MAX_ENGINE_FORCE)
- -- Rotate tailskid:
- tailSkidThrust.Force = V3(realYaw * mass * -MAX_YAW_FORCE, 0, 0)
- -- Update sound:
- --self:UpdateSound()
- CalcSounds(realThrottle)
- end
- local lastControlUpdate = tick()
- -- Update control surface animations:
- function Flyer:UpdateControls()
- local now = tick()
- local dt = (now - lastControlUpdate)
- lastControlUpdate = now
- controlDamp.Goal = V3(self.BankInput, self.PitchInput, self.YawInput)
- throttleDamp.Goal = V3(self.Throttle, 0, 0)
- local controlInputs = controlDamp:Update()
- local throttleInput = throttleDamp:Update()
- realThrottle = throttleInput.X
- local bank, pitch, yaw = controlInputs.X, controlInputs.Y, controlInputs.Z
- bank = RAD(bank * MAX_BANK)
- pitch = RAD(pitch * MAX_PITCH)
- realYaw = yaw
- yaw = RAD(yaw * MAX_YAW)
- animWelds.AileronBottomLeft.C0 = ANG(0, 0, bank)
- animWelds.AileronTopLeft.C0 = ANG(0, 0, bank)
- animWelds.AileronBottomRight.C0 = ANG(0, 0, -bank)
- animWelds.AileronTopRight.C0 = ANG(0, 0, -bank)
- animWelds.ElevatorLeft.C0 = ANG(0, 0, pitch)
- animWelds.ElevatorRight.C0 = ANG(0, 0, pitch)
- animWelds.Rudder.C0 = ANG(0, 0, yaw)
- animWelds.Joystick.C0 = ANG(0, RAD(-controlInputs.Y * MAX_JOYSTICK), RAD(-controlInputs.X * MAX_JOYSTICK))
- animWelds.Propeller.C0 = animWelds.Propeller.C0 * ANG(RAD(throttleInput.X * -5000 * dt), 0, 0)
- if (realThrottle < 0.001) then
- realThrottle = 0
- end
- end
- -- Stop the flyer:
- function Flyer:Stop()
- for _,airFoil in pairs(airFoils) do
- airFoil:Stop()
- end
- end
- -- Simulate startup:
- function Flyer:Startup()
- sStartup:Play()
- self.Throttle = 0.5
- end
- -- Simulate shutdown:
- function Flyer:Shutdown()
- sShutdown:Play()
- self.Throttle = 0
- realThrottle = 0
- sIdle:Stop()
- sLowThrottle:Stop()
- sFlying:Stop()
- end
- return Flyer
- end))
- ModuleScript169.Name = "AirFoil"
- ModuleScript169.Parent = ModuleScript168
- table.insert(cors,sandbox(ModuleScript169,function()
- -- Air Foil
- -- Crazyman32
- -- January 18, 2017
- --[[
- References:
- https://www.grc.nasa.gov/www/Wright/airplane/lifteq.html
- https://www.grc.nasa.gov/www/Wright/airplane/drageq.html
- https://www.grc.nasa.gov/www/Wright/airplane/incline.html
- This module handles the aerodynamic physics of a single airfoil by
- constantly calculating the lift and drag forces that act upon the foil.
- Note: This does NOT calculate for gravity. The game engine should invoke gravity itself.
- Note: This assumes a constant air density. Real flight would have dynamic air density based on altitude.
- EXAMPLE USE:
- local AirFoil = require(thisModule)
- local wing = AirFoil.new(part, massOfPlane)
- game:GetService("RunService").Heartbeat:Connect(function()
- wing:Update()
- end)
- Fields:
- airFoil.Part
- airFoil.Area
- airFoil.FrontalArea
- airFoil.VectorForce
- airFoil.DragAtZero
- airFoil.DragEfficiency
- airFoil.MaxForceLift
- airFoil.MaxForceDrag
- airFoil.LiftCoMultiplier
- airFoil.AspectRatio
- Methods:
- airFoil:Update()
- airFoil:Stop()
- airFoil:GetLiftCoefficient(angleOfAttack)
- airFoil:GetDragCoefficient(liftCoefficient)
- NOTE: airFoil:Update() should be called every "Heartbeat" (RunService.Heartbeat)
- --]]
- local AIR_DENSITY = 1.2754
- local PI = math.pi
- local ATAN2 = math.atan2
- local DOT = Vector3.new().Dot
- local MAX = math.max
- local DEG = math.deg
- local RAD = math.rad
- local SIN = math.sin
- local NEAR_ZERO_VECT = Vector3.new(0, 0.001, 0)
- local MAX_FORCE_LIFT = 50000
- local MAX_FORCE_DRAG = 50000
- -- Clamp a Vector3's magnitude if needed: [Only clamps upper limit]
- local function ClampMagnitude(v, mag)
- return (v.Magnitude > mag and (v.Unit * mag) or v)
- end
- local AirFoil = {}
- AirFoil.__index = AirFoil
- -- Construct new airfoil:
- -- part: The foil
- -- airplaneMass: The overall mass of the airplane
- function AirFoil.new(part, airplaneMass, overrideMaxForceLift, overrideMaxForceDrag)
- assert(airplaneMass, "Mass must be set")
- local attachment = Instance.new("Attachment",part)
- local vector_force = Instance.new("VectorForce",part)
- vector_force.RelativeTo = Enum.ActuatorRelativeTo.Attachment0
- vector_force.Attachment0 = attachment
- local airfoil = setmetatable({
- Part = part;
- Area = part.Size.X * part.Size.Z;
- FrontalArea = part.Size.X * part.Size.Y;
- VectorForce = vector_force;
- DragAtZero = 0.1; -- Drag coefficient at zero lift
- DragEfficiency = 0.7;
- MaxForceLift = (overrideMaxForceLift or MAX_FORCE_LIFT) * airplaneMass;
- MaxForceDrag = (overrideMaxForceDrag or MAX_FORCE_DRAG) * airplaneMass;
- LiftCoMultiplier = 0.01;
- AspectRatio = 0;
- }, AirFoil)
- -- Aspect ratio: (Chord^2 / WingArea)
- airfoil.AspectRatio = (part.Size.X * part.Size.X) / airfoil.Area
- return airfoil
- end
- -- Lift Coefficient:
- function AirFoil:GetLiftCoefficient(angleOfAttack)
- -- Somewhat matches a basic lift coefficient graph found online:
- local aoa = DEG(angleOfAttack)
- if (aoa < -5 or aoa > 80) then return 0 end
- local cl = MAX(0, SIN(RAD((aoa + 5) * 4))) * self.LiftCoMultiplier
- return cl
- end
- -- Drag Coefficient:
- function AirFoil:GetDragCoefficient(cl)
- -- DragCoefficient = DragCoefficientAtZeroLift + LiftCoefficient^2 / (Pi * SurfaceAspectRatio * EfficiencyFactor)
- local cd0 = self.DragAtZero
- local e = self.DragEfficiency
- local ar = self.AspectRatio
- return cd0 + (cl * cl) / (PI * ar * e)
- end
- -- Update the air foil (This should ideally be invoked during RunService.Heartbeat)
- -- Heavily commented due to complex nature of operations.
- function AirFoil:Update()
- local part = self.Part
- local v = part.Velocity
- if (v.Magnitude <= 0.0001) then v = NEAR_ZERO_VECT end
- -- Airfoil's velocity relative to its rotation:
- local vLocal = part.CFrame:vectorToObjectSpace(v)
- -- Calculate angle of attack:
- local angleOfAttack = -ATAN2(vLocal.Y, -vLocal.Z)
- --self.AOA = angleOfAttack
- -- Get Lift and Drag Coefficients:
- local lc = self:GetLiftCoefficient(angleOfAttack)
- local dc = self:GetDragCoefficient(lc)
- -- Calculate the part of lift/drag equation that both equations share:
- local common = 0.5 * AIR_DENSITY * DOT(v, v)
- -- Calculate lift and drag force multipliers:
- local lift = common * self.Area * lc * 1.5
- local drag = common * self.FrontalArea * dc * 1.0
- -- Calculate lift and drag:
- local liftForce = part.CFrame.upVector * lift
- local dragForce = -v.Unit * drag
- -- Clamp lift and drag magnitudes:
- liftForce = ClampMagnitude(liftForce, self.MaxForceLift)
- dragForce = ClampMagnitude(dragForce, self.MaxForceDrag)
- -- Apply lift and drag forces to the airfoil:
- local force = (liftForce + dragForce)
- self.VectorForce.Force = self.Part.CFrame:vectorToObjectSpace(force)
- end
- -- Simply sets the VectorForce's force to 0
- function AirFoil:Stop()
- self.VectorForce.Force = Vector3.new()
- end
- return AirFoil
- end))
- ModuleScript170.Name = "Damping"
- ModuleScript170.Parent = ModuleScript168
- table.insert(cors,sandbox(ModuleScript170,function()
- -- Damping
- -- Crazyman32
- -- September 30, 2015
- -- Updated: January 1, 2017
- --[[
- local Damping = require(this)
- local damping = Damping.new()
- damping.P = NUMBER
- damping.D = NUMBER
- damping.Position = Vector3
- damping.Goal = Vector3
- damping:Update() [Returns Vector3 position]
- damping:UpdateAngle() [Returns Vector3 position, but each XYZ value is wrapped properly for pi*2 motion]
- EXAMPLE USE:
- -- Set D and P values:
- damping.P = 5
- damping.D = 0.1
- -- Set starting position:
- damping.Position = part.Position
- while (true) do
- wait()
- -- Update the goal:
- damping.Goal = mouse.Hit.p
- -- Calculate new position:
- local newPosition = damping:Update()
- part.Position = newPosition
- end
- ALGORITHM:
- velocity += P * ( (target - current) + D * -velocity );
- current += velocity * dt;
- Credit: http://www.gamedev.net/topic/561981-smooth-value-damping/
- --]]
- local Damping = {}
- Damping.__index = Damping
- local V3 = Vector3.new
- local PI = math.pi
- local TAU = PI * 2
- local tick = tick
- local function CheckNAN(value, returnIfNan)
- return (value == value and value or returnIfNan)
- end
- local function DeltaAngle(current, target)
- local num = (target - current) % TAU
- if (num > PI) then
- num = (num - TAU)
- end
- return num
- end
- local function DeltaAngleV3(pos1, pos2)
- local x = DeltaAngle(pos1.X, pos2.X)
- local y = DeltaAngle(pos1.Y, pos2.Y)
- local z = DeltaAngle(pos1.Z, pos2.Z)
- return V3(x, y, z)
- end
- function Damping.new()
- local damping = setmetatable({
- P = 5;
- D = 0.1;
- Position = V3();
- Velocity = V3();
- Goal = V3();
- Last = tick();
- }, Damping)
- return damping
- end
- function Damping:CheckNAN()
- self.Velocity = V3(CheckNAN(self.Velocity.X, 0), CheckNAN(self.Velocity.Y, 0), CheckNAN(self.Velocity.Z, 0))
- self.Position = V3(CheckNAN(self.Position.X, self.Goal.X), CheckNAN(self.Position.Y, self.Goal.Y), CheckNAN(self.Position.Z, self.Goal.Z))
- end
- function Damping:Update()
- local t = tick()
- local dt = (t - self.Last)
- self.Last = t
- self.Velocity = (self.Velocity + (self.P * ((self.Goal - self.Position) + (-self.Velocity * self.D))))
- self.Position = (self.Position + (self.Velocity * dt))
- self:CheckNAN()
- return self.Position
- end
- function Damping:UpdateAngle()
- self.Goal = (self.Position + DeltaAngleV3(self.Position, self.Goal))
- return self:Update()
- end
- return Damping
- end))
- Model171.Name = "Parts"
- Model171.Parent = Model1
- Model172.Name = "WingStruts"
- Model172.Parent = Model171
- UnionOperation173.Name = "WingStruts"
- UnionOperation173.Parent = Model172
- UnionOperation173.CFrame = CFrame.new(-69.4999542, 8.48894596, 67.6998291, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- UnionOperation173.Orientation = Vector3.new(0, 180, 0)
- UnionOperation173.Position = Vector3.new(-69.4999542, 8.48894596, 67.6998291)
- UnionOperation173.Rotation = Vector3.new(180, 0, 180)
- UnionOperation173.Color = Color3.new(0.486275, 0.360784, 0.27451)
- UnionOperation173.Size = Vector3.new(0.400000304, 5.79999924, 4.24582148)
- UnionOperation173.Anchored = true
- UnionOperation173.BrickColor = BrickColor.new("Brown")
- UnionOperation173.Material = Enum.Material.Wood
- UnionOperation173.brickColor = BrickColor.new("Brown")
- UnionOperation173.UsePartColor = true
- ObjectValue174.Name = "DamageCollider"
- ObjectValue174.Parent = UnionOperation173
- UnionOperation175.Name = "WingStruts"
- UnionOperation175.Parent = Model172
- UnionOperation175.CFrame = CFrame.new(-42.5004807, 8.48895454, 67.6998901, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- UnionOperation175.Orientation = Vector3.new(0, 180, 0)
- UnionOperation175.Position = Vector3.new(-42.5004807, 8.48895454, 67.6998901)
- UnionOperation175.Rotation = Vector3.new(180, 0, 180)
- UnionOperation175.Color = Color3.new(0.486275, 0.360784, 0.27451)
- UnionOperation175.Size = Vector3.new(0.400000304, 5.79999924, 4.24582148)
- UnionOperation175.Anchored = true
- UnionOperation175.BrickColor = BrickColor.new("Brown")
- UnionOperation175.Material = Enum.Material.Wood
- UnionOperation175.brickColor = BrickColor.new("Brown")
- UnionOperation175.UsePartColor = true
- ObjectValue176.Name = "DamageCollider"
- ObjectValue176.Parent = UnionOperation175
- Part177.Name = "WingStrut"
- Part177.Parent = Model172
- Part177.CFrame = CFrame.new(-54.1001701, 10.3888988, 68.6998291, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part177.Orientation = Vector3.new(0, 180, 0)
- Part177.Position = Vector3.new(-54.1001701, 10.3888988, 68.6998291)
- Part177.Rotation = Vector3.new(180, 0, 180)
- Part177.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part177.Size = Vector3.new(0.200000003, 2, 0.600000024)
- Part177.Anchored = true
- Part177.BottomSurface = Enum.SurfaceType.Smooth
- Part177.BrickColor = BrickColor.new("Brown")
- Part177.Material = Enum.Material.Wood
- Part177.TopSurface = Enum.SurfaceType.Smooth
- Part177.brickColor = BrickColor.new("Brown")
- Part178.Name = "WingStrut"
- Part178.Parent = Model172
- Part178.CFrame = CFrame.new(-57.9000816, 10.3888988, 68.699707, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part178.Orientation = Vector3.new(0, 180, 0)
- Part178.Position = Vector3.new(-57.9000816, 10.3888988, 68.699707)
- Part178.Rotation = Vector3.new(180, 0, 180)
- Part178.Color = Color3.new(0.486275, 0.360784, 0.27451)
- Part178.Size = Vector3.new(0.200000003, 2, 0.600000024)
- Part178.Anchored = true
- Part178.BottomSurface = Enum.SurfaceType.Smooth
- Part178.BrickColor = BrickColor.new("Brown")
- Part178.Material = Enum.Material.Wood
- Part178.TopSurface = Enum.SurfaceType.Smooth
- Part178.brickColor = BrickColor.new("Brown")
- Model179.Name = "Cockpit"
- Model179.Parent = Model171
- Part180.Name = "CockpitPart"
- Part180.Parent = Model179
- Part180.CFrame = CFrame.new(-54.4998436, 6.88898277, 66.1998901, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part180.Orientation = Vector3.new(0, 180, 0)
- Part180.Position = Vector3.new(-54.4998436, 6.88898277, 66.1998901)
- Part180.Rotation = Vector3.new(180, 0, 180)
- Part180.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part180.Size = Vector3.new(1, 1, 2)
- Part180.Anchored = true
- Part180.BottomSurface = Enum.SurfaceType.Smooth
- Part180.BrickColor = BrickColor.new("Grime")
- Part180.CanCollide = false
- Part180.TopSurface = Enum.SurfaceType.Smooth
- Part180.brickColor = BrickColor.new("Grime")
- Part181.Name = "CockpitPart"
- Part181.Parent = Model179
- Part181.CFrame = CFrame.new(-57.5000267, 6.88898754, 66.1999512, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part181.Orientation = Vector3.new(0, 180, 0)
- Part181.Position = Vector3.new(-57.5000267, 6.88898754, 66.1999512)
- Part181.Rotation = Vector3.new(180, 0, 180)
- Part181.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part181.Size = Vector3.new(1, 1, 2)
- Part181.Anchored = true
- Part181.BottomSurface = Enum.SurfaceType.Smooth
- Part181.BrickColor = BrickColor.new("Grime")
- Part181.CanCollide = false
- Part181.TopSurface = Enum.SurfaceType.Smooth
- Part181.brickColor = BrickColor.new("Grime")
- Part182.Name = "CockpitPart"
- Part182.Parent = Model179
- Part182.CFrame = CFrame.new(-54.5001183, 7.38896942, 67.6998901, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part182.Orientation = Vector3.new(0, 180, 0)
- Part182.Position = Vector3.new(-54.5001183, 7.38896942, 67.6998901)
- Part182.Rotation = Vector3.new(180, 0, 180)
- Part182.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part182.Size = Vector3.new(1, 2, 1)
- Part182.Anchored = true
- Part182.BottomSurface = Enum.SurfaceType.Smooth
- Part182.BrickColor = BrickColor.new("Grime")
- Part182.CanCollide = false
- Part182.TopSurface = Enum.SurfaceType.Smooth
- Part182.brickColor = BrickColor.new("Grime")
- Part183.Name = "CockpitPart"
- Part183.Parent = Model179
- Part183.CFrame = CFrame.new(-57.5001183, 7.38896942, 67.6998291, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part183.Orientation = Vector3.new(0, 180, 0)
- Part183.Position = Vector3.new(-57.5001183, 7.38896942, 67.6998291)
- Part183.Rotation = Vector3.new(180, 0, 180)
- Part183.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part183.Size = Vector3.new(1, 2, 1)
- Part183.Anchored = true
- Part183.BottomSurface = Enum.SurfaceType.Smooth
- Part183.BrickColor = BrickColor.new("Grime")
- Part183.CanCollide = false
- Part183.TopSurface = Enum.SurfaceType.Smooth
- Part183.brickColor = BrickColor.new("Grime")
- Part184.Name = "CockpitPart"
- Part184.Parent = Model179
- Part184.CFrame = CFrame.new(-57.5000877, 7.38896847, 64.699707, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part184.Orientation = Vector3.new(0, 180, 0)
- Part184.Position = Vector3.new(-57.5000877, 7.38896847, 64.699707)
- Part184.Rotation = Vector3.new(180, 0, 180)
- Part184.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part184.Size = Vector3.new(1, 2, 1)
- Part184.Anchored = true
- Part184.BottomSurface = Enum.SurfaceType.Smooth
- Part184.BrickColor = BrickColor.new("Grime")
- Part184.CanCollide = false
- Part184.TopSurface = Enum.SurfaceType.Smooth
- Part184.brickColor = BrickColor.new("Grime")
- Part185.Name = "CockpitPart"
- Part185.Parent = Model179
- Part185.CFrame = CFrame.new(-56.0000725, 5.88900566, 66.2998047, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part185.Orientation = Vector3.new(0, 180, 0)
- Part185.Position = Vector3.new(-56.0000725, 5.88900566, 66.2998047)
- Part185.Rotation = Vector3.new(180, 0, 180)
- Part185.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part185.Size = Vector3.new(4, 1, 8.19999981)
- Part185.Anchored = true
- Part185.BottomSurface = Enum.SurfaceType.Smooth
- Part185.BrickColor = BrickColor.new("Grime")
- Part185.TopSurface = Enum.SurfaceType.Smooth
- Part185.brickColor = BrickColor.new("Grime")
- Part186.Name = "CockpitPart"
- Part186.Parent = Model179
- Part186.CFrame = CFrame.new(-54.5001945, 7.38896847, 64.6998901, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part186.Orientation = Vector3.new(0, 180, 0)
- Part186.Position = Vector3.new(-54.5001945, 7.38896847, 64.6998901)
- Part186.Rotation = Vector3.new(180, 0, 180)
- Part186.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part186.Size = Vector3.new(1, 2, 1)
- Part186.Anchored = true
- Part186.BottomSurface = Enum.SurfaceType.Smooth
- Part186.BrickColor = BrickColor.new("Grime")
- Part186.CanCollide = false
- Part186.TopSurface = Enum.SurfaceType.Smooth
- Part186.brickColor = BrickColor.new("Grime")
- Part187.Name = "CockpitPart"
- Part187.Parent = Model179
- Part187.CFrame = CFrame.new(-56.0001335, 7.88896275, 69.2999268, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part187.Orientation = Vector3.new(0, 180, 0)
- Part187.Position = Vector3.new(-56.0001335, 7.88896275, 69.2999268)
- Part187.Rotation = Vector3.new(180, 0, 180)
- Part187.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part187.Size = Vector3.new(4, 3, 2.20000005)
- Part187.Anchored = true
- Part187.BottomSurface = Enum.SurfaceType.Smooth
- Part187.BrickColor = BrickColor.new("Grime")
- Part187.TopSurface = Enum.SurfaceType.Smooth
- Part187.brickColor = BrickColor.new("Grime")
- Part188.Name = "CockpitPart"
- Part188.Parent = Model179
- Part188.CFrame = CFrame.new(-56.0001183, 7.88895512, 63.2002563, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part188.Orientation = Vector3.new(0, 180, 0)
- Part188.Position = Vector3.new(-56.0001183, 7.88895512, 63.2002563)
- Part188.Rotation = Vector3.new(180, 0, 180)
- Part188.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part188.Size = Vector3.new(4, 3, 2)
- Part188.Anchored = true
- Part188.BottomSurface = Enum.SurfaceType.Smooth
- Part188.BrickColor = BrickColor.new("Grime")
- Part188.CanCollide = false
- Part188.TopSurface = Enum.SurfaceType.Smooth
- Part188.brickColor = BrickColor.new("Grime")
- ObjectValue189.Name = "DamageCollider"
- ObjectValue189.Parent = Part188
- Part190.Name = "SeatBack"
- Part190.Parent = Model179
- Part190.CFrame = CFrame.new(-56.000164, 7.88895512, 64.9998779, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part190.Orientation = Vector3.new(0, 180, 0)
- Part190.Position = Vector3.new(-56.000164, 7.88895512, 64.9998779)
- Part190.Rotation = Vector3.new(180, 0, 180)
- Part190.Color = Color3.new(0.972549, 0.972549, 0.972549)
- Part190.Size = Vector3.new(2, 3, 0.399999976)
- Part190.Anchored = true
- Part190.BottomSurface = Enum.SurfaceType.Smooth
- Part190.BrickColor = BrickColor.new("Institutional white")
- Part190.CanCollide = false
- Part190.Material = Enum.Material.Fabric
- Part190.TopSurface = Enum.SurfaceType.Smooth
- Part190.brickColor = BrickColor.new("Institutional white")
- Model191.Name = "LandingGear"
- Model191.Parent = Model171
- UnionOperation192.Name = "LandingGear"
- UnionOperation192.Parent = Model191
- UnionOperation192.CFrame = CFrame.new(-55.9999504, 4.16310406, 69.5565796, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- UnionOperation192.Orientation = Vector3.new(0, 180, 0)
- UnionOperation192.Position = Vector3.new(-55.9999504, 4.16310406, 69.5565796)
- UnionOperation192.Rotation = Vector3.new(180, 0, 180)
- UnionOperation192.Color = Color3.new(0.486275, 0.360784, 0.27451)
- UnionOperation192.Size = Vector3.new(5, 2.74807787, 1.68660378)
- UnionOperation192.Anchored = true
- UnionOperation192.BrickColor = BrickColor.new("Brown")
- UnionOperation192.Material = Enum.Material.Wood
- UnionOperation192.brickColor = BrickColor.new("Brown")
- UnionOperation192.UsePartColor = true
- Part193.Name = "WheelLeft"
- Part193.Parent = Model191
- Part193.CFrame = CFrame.new(-53.4001884, 2.88909817, 70.3001709, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part193.Orientation = Vector3.new(0, 180, 0)
- Part193.Position = Vector3.new(-53.4001884, 2.88909817, 70.3001709)
- Part193.Rotation = Vector3.new(180, 0, 180)
- Part193.Color = Color3.new(0.0156863, 0.686275, 0.92549)
- Part193.Size = Vector3.new(0.200000003, 3, 3)
- Part193.Anchored = true
- Part193.BottomSurface = Enum.SurfaceType.Smooth
- Part193.BrickColor = BrickColor.new("Cyan")
- Part193.CustomPhysicalProperties = 7.8499999, 2, 0.25, 2, 1
- Part193.Material = Enum.Material.Metal
- Part193.TopSurface = Enum.SurfaceType.Smooth
- Part193.brickColor = BrickColor.new("Cyan")
- Part193.Shape = Enum.PartType.Cylinder
- HingeConstraint194.Parent = Part193
- HingeConstraint194.Attachment0 = nil
- HingeConstraint194.Attachment1 = nil
- Part195.Name = "WheelRight"
- Part195.Parent = Model191
- Part195.CFrame = CFrame.new(-58.6002159, 2.88910103, 70.3000488, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part195.Orientation = Vector3.new(0, 180, 0)
- Part195.Position = Vector3.new(-58.6002159, 2.88910103, 70.3000488)
- Part195.Rotation = Vector3.new(180, 0, 180)
- Part195.Color = Color3.new(0.639216, 0.294118, 0.294118)
- Part195.Size = Vector3.new(0.200000003, 3, 3)
- Part195.Anchored = true
- Part195.BottomSurface = Enum.SurfaceType.Smooth
- Part195.BrickColor = BrickColor.new("Dusty Rose")
- Part195.CustomPhysicalProperties = 7.8499999, 2, 0.25, 2, 1
- Part195.Material = Enum.Material.Metal
- Part195.TopSurface = Enum.SurfaceType.Smooth
- Part195.brickColor = BrickColor.new("Dusty Rose")
- Part195.Shape = Enum.PartType.Cylinder
- HingeConstraint196.Parent = Part195
- HingeConstraint196.Attachment0 = nil
- HingeConstraint196.Attachment1 = nil
- Model197.Name = "Tail"
- Model197.Parent = Model171
- Part198.Name = "TailSection"
- Part198.Parent = Model197
- Part198.CFrame = CFrame.new(-56.0000572, 7.38896561, 60.6997681, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part198.Orientation = Vector3.new(0, 180, 0)
- Part198.Position = Vector3.new(-56.0000572, 7.38896561, 60.6997681)
- Part198.Rotation = Vector3.new(180, 0, 180)
- Part198.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part198.Size = Vector3.new(3, 3, 3)
- Part198.Anchored = true
- Part198.BottomSurface = Enum.SurfaceType.Smooth
- Part198.BrickColor = BrickColor.new("Grime")
- Part198.TopSurface = Enum.SurfaceType.Smooth
- Part198.brickColor = BrickColor.new("Grime")
- ObjectValue199.Name = "DamageCollider"
- ObjectValue199.Parent = Part198
- Part200.Name = "TailSection"
- Part200.Parent = Model197
- Part200.CFrame = CFrame.new(-56.0000572, 7.38896275, 57.6999512, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part200.Orientation = Vector3.new(0, 180, 0)
- Part200.Position = Vector3.new(-56.0000572, 7.38896275, 57.6999512)
- Part200.Rotation = Vector3.new(180, 0, 180)
- Part200.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part200.Size = Vector3.new(2, 2, 3)
- Part200.Anchored = true
- Part200.BottomSurface = Enum.SurfaceType.Smooth
- Part200.BrickColor = BrickColor.new("Grime")
- Part200.TopSurface = Enum.SurfaceType.Smooth
- Part200.brickColor = BrickColor.new("Grime")
- ObjectValue201.Name = "DamageCollider"
- ObjectValue201.Parent = Part200
- Part202.Name = "TailSection"
- Part202.Parent = Model197
- Part202.CFrame = CFrame.new(-56.0000725, 7.38895988, 54.6997681, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part202.Orientation = Vector3.new(0, 180, 0)
- Part202.Position = Vector3.new(-56.0000725, 7.38895988, 54.6997681)
- Part202.Rotation = Vector3.new(180, 0, 180)
- Part202.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part202.Size = Vector3.new(1, 1.39999998, 3)
- Part202.Anchored = true
- Part202.BottomSurface = Enum.SurfaceType.Smooth
- Part202.BrickColor = BrickColor.new("Grime")
- Part202.TopSurface = Enum.SurfaceType.Smooth
- Part202.brickColor = BrickColor.new("Grime")
- ObjectValue203.Name = "DamageCollider"
- ObjectValue203.Parent = Part202
- Part204.Name = "TailSection"
- Part204.Parent = Model197
- Part204.CFrame = CFrame.new(-55.9998741, 7.38894653, 49.699585, -1.00000048, -3.01952296e-10, 3.51518673e-20, 3.01952296e-10, 1, -4.65661287e-10, 3.51518673e-20, 4.65661287e-10, -1)
- Part204.Orientation = Vector3.new(0, 180, 0)
- Part204.Position = Vector3.new(-55.9998741, 7.38894653, 49.699585)
- Part204.Rotation = Vector3.new(180, 0, 180)
- Part204.Color = Color3.new(0.498039, 0.556863, 0.392157)
- Part204.Size = Vector3.new(0.400000006, 1, 7)
- Part204.Anchored = true
- Part204.BottomSurface = Enum.SurfaceType.Smooth
- Part204.BrickColor = BrickColor.new("Grime")
- Part204.TopSurface = Enum.SurfaceType.Smooth
- Part204.brickColor = BrickColor.new("Grime")
- ObjectValue205.Name = "DamageCollider"
- ObjectValue205.Parent = Part204
- Part206.Name = "RegenButton"
- Part206.Parent = Model0
- Part206.CFrame = CFrame.new(-28.58358, 0.587299347, 50.3664551, -0.000334412878, -0.0429414362, 0.999077916, 0.0156064332, 0.998955727, 0.0429414026, -0.999878168, 0.0156063959, 0.000336099416)
- Part206.Orientation = Vector3.new(-2.46000004, 89.9800034, 0.899999976)
- Part206.Position = Vector3.new(-28.58358, 0.587299347, 50.3664551)
- Part206.Rotation = Vector3.new(-89.5500031, 87.5400009, 90.4499969)
- Part206.Color = Color3.new(0.627451, 0.372549, 0.207843)
- Part206.Size = Vector3.new(3, 1, 3)
- Part206.Anchored = true
- Part206.BottomSurface = Enum.SurfaceType.Smooth
- Part206.BrickColor = BrickColor.new("Dark orange")
- Part206.CanCollide = false
- Part206.Material = Enum.Material.Wood
- Part206.TopSurface = Enum.SurfaceType.Smooth
- Part206.brickColor = BrickColor.new("Dark orange")
- SurfaceGui207.Parent = Part206
- SurfaceGui207.Face = Enum.NormalId.Top
- SurfaceGui207.CanvasSize = Vector2.new(400, 400)
- TextLabel208.Name = "Label"
- TextLabel208.Parent = SurfaceGui207
- TextLabel208.Size = UDim2.new(1, 0, 1, 0)
- TextLabel208.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel208.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel208.BackgroundTransparency = 1
- TextLabel208.Font = Enum.Font.SourceSans
- TextLabel208.FontSize = Enum.FontSize.Size96
- TextLabel208.Text = "Touch to Spawn Plane"
- TextLabel208.TextColor = BrickColor.new("Institutional white")
- TextLabel208.TextColor3 = Color3.new(1, 1, 1)
- TextLabel208.TextSize = 96
- TextLabel208.TextWrap = true
- TextLabel208.TextWrapped = true
- Script209.Name = "Regeneration"
- Script209.Parent = Model0
- table.insert(cors,sandbox(Script209,function()
- -- Regeneration
- -- Crazyman32
- -- January 19, 2017
- --[[
- This script allows the plane to be regenerated cleanly. The idea of
- vehicle regeneration (or "regen" for short) goes back to old ROBLOX
- vehicles (from 2007/2008). With those old systems, the word
- "regeneration" was more appropriate, since there would only be one
- vehicle per system, so regenerating the vehicle was literally the
- process of getting rid of the old one (if it was still there) and
- putting a new one in its place.
- Nowadays, "regen" systems are more-so just vehicle spawn points. For
- the sake of old consistency, I like to keep the name "Regeneration."
- Logic of the regeneration system:
- 1. Player touches the button.
- If the system is active, STOP. Else, go to step 2.
- 2. Set the regen system as "active."
- 3. Remove idle planes within the regeneration radius.
- 4. Check if the regeneration radius is clear.
- If the system is clear, go to step 5. Else, STOP.
- 5. Regenerate plane (i.e. create a new copy of the plane and spawn it).
- 6. Wait a few seconds (cooldown) so that players cannot spam regen button.
- 7. Set the regen system as "not active."
- --]]
- -- If another plane in the system is within this radius of the respawn
- -- area, then the system will deny a regeneration request:
- local REGEN_RADIUS = 30
- -- If a plane is idle for this many seconds, then the plane will be
- -- destroyed. A plane is considered idle when a player exits the
- -- pilot seat:
- local MAX_IDLE_BEFORE_CLEANUP = 30
- -- Seconds to wait after a regen before another regen is allowed:
- local COOLDOWN = 5
- -- The name of the plane within the plane system:
- local PLANE_NAME = "Plane"
- local regenBtn = script.Parent:FindFirstChild("RegenButton")
- local regenLbl = (regenBtn and regenBtn:FindFirstChild("SurfaceGui") and regenBtn.SurfaceGui:FindFirstChild("Label"))
- local plane = script.Parent[PLANE_NAME]
- if (regenBtn) then
- plane = plane:Clone()
- end
- local regenPos = plane:WaitForChild("Functional"):WaitForChild("PilotSeat").Position
- -- Button debounce:
- local active = false
- function Track(p)
- -- Inform welder script that it can go ahead and weld the plane:
- p:WaitForChild("ReadyToWeld").Value = true
- local seat = p:WaitForChild("Functional"):WaitForChild("PilotSeat")
- local idleTag = -1
- -- Mark plane as idle and destroy the plane if it is idle too long:
- local function Idle()
- local tag = tick()
- idleTag = tag
- while (tag == idleTag) do
- local dur = (tick() - tag)
- if (dur > MAX_IDLE_BEFORE_CLEANUP) then
- p:Destroy()
- break
- end
- wait(1)
- end
- end
- -- Listen for players to sit or get out of the pilot seat:
- seat.Changed:Connect(function(prop)
- if (prop == "Occupant") then
- if (seat.Occupant) then
- -- New occupant; the plane is no longer idle:
- idleTag = -1
- else
- -- No occupant; mark the plane as idle:
- spawn(Idle)
- end
- end
- end)
- end
- -- Regenerate (i.e. "respawn") the plane:
- function Regen()
- local p = plane:Clone()
- p.Parent = script.Parent
- p:MakeJoints()
- wait(0.5)
- Track(p)
- end
- -- Set the transparency of the regen button and it's text label:
- function SetTransparency(t)
- if (regenBtn) then
- regenBtn.Transparency = t
- if (regenLbl) then
- regenLbl.TextTransparency = t
- end
- end
- end
- -- Check if the spawn location is clear (also removes idle planes within spawn radius):
- function IsSpawnClear()
- local isClear = true
- local clearedPlane = false
- for _,v in pairs(script.Parent:GetChildren()) do
- if (v.Name == plane.Name and v:FindFirstChild("Functional") and v.Functional:FindFirstChild("PilotSeat")) then
- local seat = v.Functional.PilotSeat
- local dist = (seat.Position - regenPos).Magnitude
- if (dist < REGEN_RADIUS) then
- if (seat.Occupant) then
- isClear = false
- else
- v:Destroy()
- clearedPlane = true
- end
- end
- end
- end
- if (clearedPlane and isClear) then
- wait(1)
- end
- return isClear
- end
- -- Regen button is touched:
- function RegenTouched(object)
- -- Debounce:
- if (active) then return end
- active = true
- local player = game.Players:GetPlayerFromCharacter(object.Parent)
- -- If we've confirmed it was a player that touched the regen button:
- if (player) then
- SetTransparency(0.5)
- -- If the spawn isn't clear, don't regenerate a plane:
- if (not IsSpawnClear()) then
- SetTransparency(0)
- active = false
- return
- end
- SetTransparency(1)
- -- Regenerate a plane:
- Regen()
- wait(COOLDOWN)
- SetTransparency(0)
- end
- active = false
- end
- -- Track button touches:
- if (regenBtn) then
- regenBtn.Touched:Connect(RegenTouched)
- end
- -- Set up the initial aircraft in the system:
- Track(script.Parent[PLANE_NAME])
- end))
- Script210.Name = "README"
- Script210.Parent = Model0
- table.insert(cors,sandbox(Script210,function()
- --[[
- Creator: Crazyman32 https://www.roblox.com/users/308165/profile
- The purpose of creating this plane was to attempt to simulate real
- aerophysics of an aircraft. It is not perfect! Feel free to edit
- things as you wish.
- I have tried to write these scripts in a manner that would be
- readable, and have included many comments throughout every single
- script.
- -----------------------------------------------------------------------------------------
- The section below goes into high-level detail of each script
- in the plane. If you're wondering what one of the scripts does,
- then this is the place for you!
- Script outline:
- system > Regeneration
- Regeneration script. Handles respawning the aircraft.
- system > Plane > Welder
- Welds the plane together. The Regeneration script needs to inform
- this script to start. Yields until that occurs.
- system > Plane > Damage
- Handles plane damage and removal after death.
- system > Plane > Flyer
- The heart of the aircraft. This module is responsible for properly
- setting up and simulating the aircraft as a whole. This module is
- used both server-side and client-side.
- system > Plane > Flyer > AirFoil
- This is the phsyics simulator per air foil. A "foil" is simply
- some sort of surface that is simulated through some sort of
- fluid; in this case, air. An example of an air foil is a wing.
- To put it simply, the AirFoil module calculates lift and drag
- forces on a part based on the parts orientation and velocity.
- system > Plane > Flyer > Damping
- This is a module used by the flyer and also the CamLock module. It
- is used to damp various controls and inputs, which makes things
- appear much smoother. NOTE that "Damping" is not the same as "Dampening."
- According to dictionary.com, the word Damping can mean "a reduction
- in the amplitude of an oscillation or vibration as a result of energy
- being dissipated as heat." For example, think of the smooth movements
- of a hydraulic system. Such a system can somewhat be immitated through
- using this module.
- system > Plane > Controller
- This is the server-side controller for the aircraft. It has a
- couple of functions. Firstly, it simulates the plane's physics
- when no player is in the plane. Secondly, it handles when a
- player enters or exits the Pilot Seat. When a player enters
- the seat, this script gives over the controls to the player by
- cloning the LocalController script into the player's Backpack.
- When the player leaves the aircraft, this script removes the
- LocalController from the player and takes over physics simulation
- again.
- system > Plane > Controller > LocalController
- This is the client-side controller for the plane. This script
- allows the player to actually control the aircraft.
- system > Plane > Controller > LocalController > CamLock
- Handles the player's camera while in the plane. This uses complex
- operations to maintain fluid camera movements and interpolations
- between views, as well as simulate a feeling of "movement" in the
- plane by rotating and shaking the camera based on plane movement.
- system > Plane > Controller > LocalController > Controls
- This module holds other control modules that simplify user input.
- The LocalController uses these modules to read user input in order
- to maneuver the aircraft.
- system > Plane > Controller > LocalController > (GUI) > GuiController
- For each ScreenGui, there is a a GuiController module. This module
- is what keeps the the UI updated and also sends UI information
- back to the LocalController. Each GuiController is unique in its
- operations and is chosen based on which platform the user is using.
- -----------------------------------------------------------------------------------------
- Order of script operations:
- 1. Regeneration script respawns a new plane
- 2. Regeneration script informs the plane's Welder script to weld
- the plane
- 3. Welder script welds the plane, and creates an object to denote
- the plane is welded
- 4. Damage script starts working by watching parts for high-velocity
- touches
- 5. Controller script sees that the plane is welded, and starts its
- operations
- 5.1. Controller script sees a player enter the PilotSeat, and gives
- the player the LocalController script
- 5.2. LocalController script operates and allows the player to fly the
- plane
- 5.3. Controller script sees the player leave th PilotSeat, and removes
- the LocalController script from the player
- -----------------------------------------------------------------------------------------
- Build notes:
- - All parts that scripts interact with are located in the plane's
- "Functional" model
- - All parts in the "Parts" model are simply for looks (however, some may
- also be used to listen for touches in the Damage script)
- - Any part that contains a "DamageCollider" object will be used by the
- Damage script to listen for high-velocity touches/impacts
- - The design is supposed to look simple/blocky, since the goal was a
- realistic-flying plane, not a realistic-looking plane
- --]]
- end))
- Script210.Disabled = true
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = workspace
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement