Advertisement
Godofadmin1337

carpet

Oct 3rd, 2017
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.54 KB | None | 0 0
  1.  
  2. --Converted with ttyyuu12345's model to script plugin v4
  3. function sandbox(var,func)
  4. local env = getfenv(func)
  5. local newenv = setmetatable({},{
  6. __index = function(self,k)
  7. if k=="script" then
  8. return var
  9. else
  10. return env[k]
  11. end
  12. end,
  13. })
  14. setfenv(func,newenv)
  15. return func
  16. end
  17. cors = {}
  18. mas = Instance.new("Model",game:GetService("Lighting"))
  19. Tool0 = Instance.new("Tool")
  20. Part1 = Instance.new("Part")
  21. Script2 = Instance.new("Script")
  22. Script3 = Instance.new("Script")
  23. LocalScript4 = Instance.new("LocalScript")
  24. LocalScript5 = Instance.new("LocalScript")
  25. Animation6 = Instance.new("Animation")
  26. Tool0.Name = "RainbowMagicCarpet"
  27. Tool0.Parent = mas
  28. Tool0.TextureId = "http://www.roblox.com/asset/?id=223080070"
  29. Tool0.GripForward = Vector3.new(1, -0, -0)
  30. Tool0.GripPos = Vector3.new(-1.5, 0, 0)
  31. Tool0.GripRight = Vector3.new(0, -1, 8.90154915e-05)
  32. Tool0.GripUp = Vector3.new(0, 8.90154915e-05, 1)
  33. Part1.Name = "Handle"
  34. Part1.Parent = Tool0
  35. Part1.Transparency = 1
  36. Part1.Rotation = Vector3.new(26.9399986, 32.9500008, -15.4499998)
  37. Part1.RotVelocity = Vector3.new(1, 1, 1)
  38. Part1.Velocity = Vector3.new(0.387323916, -0.529731154, 0.343548596)
  39. Part1.Locked = true
  40. Part1.FormFactor = Enum.FormFactor.Custom
  41. Part1.Size = Vector3.new(3, 0.5, 6.5)
  42. Part1.CFrame = CFrame.new(-172.666, 15.5135136, -54.6277771, 0.808857679, 0.223549709, 0.54385227, -2.32231105e-08, 0.924911082, -0.380183399, -0.588004947, 0.307514131, 0.74812144)
  43. Part1.BottomSurface = Enum.SurfaceType.Smooth
  44. Part1.TopSurface = Enum.SurfaceType.Smooth
  45. Part1.Position = Vector3.new(-172.666, 15.5135136, -54.6277771)
  46. Part1.Orientation = Vector3.new(22.3500004, 36.0200005, 0)
  47. Script2.Parent = Tool0
  48. table.insert(cors,sandbox(Script2,function()
  49. --Made by Luckymaxer
  50.  
  51. Tool = script.Parent
  52. Handle = Tool:WaitForChild("Handle")
  53.  
  54. Players = game:GetService("Players")
  55. Debris = game:GetService("Debris")
  56.  
  57. RemovalMonitor = script:WaitForChild("RemovalMonitor")
  58.  
  59. CarpetPieces = {
  60. {MeshId = 0, Angle = 160},
  61. {MeshId = 0, Angle = 100},
  62. {MeshId = 0, Angle = 100},
  63. {MeshId = 0, Angle = 160},
  64. }
  65.  
  66. CarpetSize = Vector3.new(3, 0.5, 6.5)
  67.  
  68. BaseUrl = "http://www.roblox.com/asset/?id="
  69.  
  70. Rate = (1 / 10)
  71.  
  72. BasePart = Instance.new("Part")
  73. BasePart.Material = Enum.Material.Plastic
  74. BasePart.Shape = Enum.PartType.Block
  75. BasePart.TopSurface = Enum.SurfaceType.Smooth
  76. BasePart.BottomSurface = Enum.SurfaceType.Smooth
  77. BasePart.FormFactor = Enum.FormFactor.Custom
  78. BasePart.Size = Vector3.new(0.2, 0.2, 0.2)
  79. BasePart.CanCollide = true
  80. BasePart.Locked = true
  81.  
  82. ColorPart = BasePart:Clone()
  83. ColorPart.Name = "ColorPart"
  84. ColorPart.Reflectance = 0.25
  85. ColorPart.Transparency = 0.1
  86. ColorPart.Material = Enum.Material.SmoothPlastic
  87. ColorPart.FrontSurface = Enum.SurfaceType.SmoothNoOutlines
  88. ColorPart.BackSurface = Enum.SurfaceType.SmoothNoOutlines
  89. ColorPart.TopSurface = Enum.SurfaceType.SmoothNoOutlines
  90. ColorPart.BottomSurface = Enum.SurfaceType.SmoothNoOutlines
  91. ColorPart.LeftSurface = Enum.SurfaceType.SmoothNoOutlines
  92. ColorPart.RightSurface = Enum.SurfaceType.SmoothNoOutlines
  93. ColorPart.Size = Vector3.new(1, 1, 1)
  94. ColorPart.Anchored = true
  95. ColorPart.CanCollide = false
  96. ColorMesh = Instance.new("SpecialMesh")
  97. ColorMesh.Name = "Mesh"
  98. ColorMesh.MeshType = Enum.MeshType.FileMesh
  99. ColorMesh.MeshId = (BaseUrl .. "0")
  100. ColorMesh.TextureId = (BaseUrl .. "0")
  101. ColorMesh.Scale = (ColorPart.Size * 2) --Default mesh scale is 1/2 the size of a 1x1x1 brick.
  102. ColorMesh.Offset = Vector3.new(0, 0, 0)
  103. ColorMesh.VertexColor = Vector3.new(1, 1, 1)
  104. ColorMesh.Parent = ColorPart
  105. ColorLight = Instance.new("PointLight")
  106. ColorLight.Name = "Light"
  107. ColorLight.Brightness = 50
  108. ColorLight.Range = 8
  109. ColorLight.Shadows = false
  110. ColorLight.Enabled = true
  111. ColorLight.Parent = ColorPart
  112.  
  113. RainbowColors = {
  114. Vector3.new(1, 0, 0),
  115. Vector3.new(1, 0.5, 0),
  116. Vector3.new(1, 1, 0),
  117. Vector3.new(0, 1, 0),
  118. Vector3.new(0, 1, 1),
  119. Vector3.new(0, 0, 1),
  120. Vector3.new(0.5, 0, 1)
  121. }
  122.  
  123. Animations = {
  124. Sit = {Animation = Tool:WaitForChild("Sit"), FadeTime = nil, Weight = nil, Speed = nil, Duration = nil},
  125. }
  126.  
  127. Grips = {
  128. Normal = CFrame.new(-1.5, 0, 0, 0, 0, -1, -1, 8.90154915e-005, 0, 8.90154915e-005, 1, 0),
  129. Flying = CFrame.new(-1.5, 0.5, -0.75, -1, 0, -8.99756625e-009, -8.99756625e-009, 8.10000031e-008, 1, 7.28802977e-016, 0.99999994, -8.10000103e-008)
  130. }
  131.  
  132. Flying = false
  133. ToolEquipped = false
  134.  
  135. ServerControl = (Tool:FindFirstChild("ServerControl") or Instance.new("RemoteFunction"))
  136. ServerControl.Name = "ServerControl"
  137. ServerControl.Parent = Tool
  138.  
  139. ClientControl = (Tool:FindFirstChild("ClientControl") or Instance.new("RemoteFunction"))
  140. ClientControl.Name = "ClientControl"
  141. ClientControl.Parent = Tool
  142.  
  143. Handle.Transparency = 0
  144. Tool.Grip = Grips.Normal
  145. Tool.Enabled = true
  146.  
  147. function Clamp(Number, Min, Max)
  148. return math.max(math.min(Max, Number), Min)
  149. end
  150.  
  151. function TransformModel(Objects, Center, NewCFrame, Recurse)
  152. local Objects = ((type(Objects) ~= "table" and {Objects}) or Objects)
  153. for i, v in pairs(Objects) do
  154. if v:IsA("BasePart") then
  155. v.CFrame = NewCFrame:toWorldSpace(Center:toObjectSpace(v.CFrame))
  156. end
  157. if Recurse then
  158. TransformModel(v:GetChildren(), Center, NewCFrame, true)
  159. end
  160. end
  161. end
  162.  
  163. function Weld(Parent, PrimaryPart)
  164. local Parts = {}
  165. local Welds = {}
  166. local function WeldModel(Parent, PrimaryPart)
  167. for i, v in pairs(Parent:GetChildren()) do
  168. if v:IsA("BasePart") then
  169. if v ~= PrimaryPart then
  170. local Weld = Instance.new("Weld")
  171. Weld.Name = "Weld"
  172. Weld.Part0 = PrimaryPart
  173. Weld.Part1 = v
  174. Weld.C0 = PrimaryPart.CFrame:inverse()
  175. Weld.C1 = v.CFrame:inverse()
  176. Weld.Parent = PrimaryPart
  177. table.insert(Welds, Weld)
  178. end
  179. table.insert(Parts, v)
  180. end
  181. WeldModel(v, PrimaryPart)
  182. end
  183. end
  184. WeldModel(Parent, PrimaryPart)
  185. return Parts, Welds
  186. end
  187.  
  188. function CleanUp()
  189. for i, v in pairs(Tool:GetChildren()) do
  190. if v:IsA("BasePart") and v ~= Handle then
  191. v:Destroy()
  192. end
  193. end
  194. end
  195.  
  196. function CreateRainbow(Length)
  197. local RainbowModel = Instance.new("Model")
  198. RainbowModel.Name = "RainbowPart"
  199. for i, v in pairs(RainbowColors) do
  200. local Part = ColorPart:Clone()
  201. Part.Name = "Part"
  202. Part.Size = Vector3.new(0.5, 0.5, Length)
  203. Part.CFrame = Part.CFrame * CFrame.new((Part.Size.X * (i - 1)), 0, 0)
  204. Part.Mesh.Scale = (Part.Size * 2)
  205. Part.Mesh.VertexColor = v
  206. Part.Light.Color = Color3.new(v.X, v.Y, v.Z)
  207. Part.Parent = RainbowModel
  208. end
  209. local RainbowBoundingBox = BasePart:Clone()
  210. RainbowBoundingBox.Name = "BoundingBox"
  211. RainbowBoundingBox.Transparency = 1
  212. RainbowBoundingBox.Size = RainbowModel:GetModelSize()
  213. RainbowBoundingBox.Anchored = true
  214. RainbowBoundingBox.CanCollide = false
  215. RainbowBoundingBox.CFrame = RainbowModel:GetModelCFrame()
  216. RainbowBoundingBox.Parent = RainbowModel
  217. return RainbowModel
  218. end
  219.  
  220. function GetRainbowModel()
  221. local ModelName = (Player.Name .. "'s Rainbow")
  222. local Model = game:GetService("Workspace"):FindFirstChild(ModelName)
  223. if not Model then
  224. Model = Instance.new("Model")
  225. Model.Name = ModelName
  226. local RemovalMonitorClone = RemovalMonitor:Clone()
  227. RemovalMonitorClone.Disabled = false
  228. RemovalMonitorClone.Parent = Model
  229. end
  230. return Model
  231. end
  232.  
  233. function CheckIfAlive()
  234. return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
  235. end
  236.  
  237. function Activated()
  238. if not Tool.Enabled then
  239. return
  240. end
  241. Tool.Enabled = false
  242. Flying = not Flying
  243. if Flying then
  244. Handle.Transparency = 1
  245. CleanUp()
  246. local CarpetParts = {}
  247. for i, v in pairs(CarpetPieces) do
  248. local CarpetPart = BasePart:Clone()
  249. CarpetPart.Size = Vector3.new(CarpetSize.X, CarpetSize.Y, (CarpetSize.Z / #CarpetPieces))
  250. local Mesh = Instance.new("SpecialMesh")
  251. Mesh.MeshType = Enum.MeshType.FileMesh
  252. Mesh.MeshId = (BaseUrl .. v.MeshId)
  253. Mesh.TextureId = (BaseUrl .. "0")
  254. Mesh.Scale = Vector3.new(1.125, 1.125, 1.125)
  255. Mesh.VertexColor = Vector3.new(1, 1, 1)
  256. Mesh.Offset = Vector3.new(0, 0, 0)
  257. Mesh.Parent = CarpetPart
  258. local Weld = Instance.new("Weld")
  259. Weld.Part0 = Handle
  260. Weld.Part1 = CarpetPart
  261. local XOffset = (((i == 1 or i == #CarpetPieces) and -0.005) or 0)
  262. local YOffset = ((-((Handle.Size.Z / 2) - (CarpetPart.Size.Z / 2))) + ((CarpetPart.Size.Z * (i - 1))) + ((i == 2 and 0.245) or (i == 3 and 0.04) or (i == #CarpetPieces and 0.28) or 0))
  263. Weld.C1 = CFrame.new(0, XOffset, YOffset)
  264. Weld.Parent = CarpetPart
  265. table.insert(CarpetParts, {Part = CarpetPart, Weld = Weld, InitialCFrame = Weld.C0, Angle = v.Angle})
  266. CarpetPart.Parent = Tool
  267. end
  268.  
  269. Spawn(function()
  270. InvokeClient("PlayAnimation", Animations.Sit)
  271. Tool.Grip = Grips.Flying
  272. end)
  273.  
  274. FlightSpin = Instance.new("BodyGyro")
  275. FlightSpin.Name = "FlightSpin"
  276. FlightSpin.P = 1000000
  277. FlightSpin.maxTorque = Vector3.new(FlightSpin.P, FlightSpin.P, FlightSpin.P)
  278. FlightSpin.cframe = Torso.CFrame
  279.  
  280. FlightPower = Instance.new("BodyVelocity")
  281. FlightPower.Name = "FlightPower"
  282. FlightPower.velocity = Vector3.new(0, 0, 0)
  283. FlightPower.P = 1000000
  284. FlightPower.maxForce = Vector3.new(FlightPower.P, FlightPower.P, FlightPower.P)
  285. FlightPower.P = 10000
  286.  
  287. FlightHold = Instance.new("BodyPosition")
  288. FlightHold.Name = "FlightHold"
  289. FlightHold.P = 100000
  290. FlightHold.maxForce = Vector3.new(0, 0, 0)
  291. FlightHold.position = Torso.Position
  292.  
  293. FlightSpin.Parent = Torso
  294. FlightPower.Parent = Torso
  295. FlightHold.Parent = Torso
  296.  
  297. Spawn(function()
  298. local LastPlace = nil
  299. while Flying and ToolEquipped and CheckIfAlive() do
  300.  
  301. local CurrentPlace = Handle.Position
  302. local Velocity = Torso.Velocity
  303. Velocity = Vector3.new(Velocity.X, 0, Velocity.Z).magnitude
  304.  
  305. if LastPlace and Velocity > 10 then
  306.  
  307. Spawn(function()
  308. local Model = GetRainbowModel()
  309. local Distance = (LastPlace - CurrentPlace).magnitude
  310. local Length = Distance + 3.5
  311.  
  312. local RainbowModel = CreateRainbow(Length)
  313.  
  314. --Thanks so much to ArceusInator for helping solve this part!
  315. local RainbowCFrame = CFrame.new((LastPlace + (CurrentPlace - LastPlace).unit * (Distance / 2)), CurrentPlace)
  316.  
  317. TransformModel(RainbowModel, RainbowModel:GetModelCFrame(), RainbowCFrame, true)
  318. Debris:AddItem(RainbowModel, 1)
  319. RainbowModel.Parent = Model
  320.  
  321. if Model and not Model.Parent then
  322. Model.Parent = game:GetService("Workspace")
  323. end
  324.  
  325. LastPlace = CurrentPlace
  326. end)
  327. elseif not LastPlace then
  328. LastPlace = CurrentPlace
  329. end
  330.  
  331. wait(Rate)
  332. end
  333. end)
  334. elseif not Flying then
  335. Torso.Velocity = Vector3.new(0, 0, 0)
  336. Torso.RotVelocity = Vector3.new(0, 0, 0)
  337.  
  338. for i, v in pairs({FlightSpin, FlightPower, FlightHold}) do
  339. if v and v.Parent then
  340. v:Destroy()
  341. end
  342. end
  343. Spawn(function()
  344. Tool.Grip = Grips.Normal
  345. InvokeClient("StopAnimation", Animations.Sit)
  346. end)
  347. end
  348.  
  349. wait(2)
  350.  
  351. Tool.Enabled = true
  352. end
  353.  
  354. function Equipped(Mouse)
  355. Character = Tool.Parent
  356. Humanoid = Character:FindFirstChild("Humanoid")
  357. Torso = Character:FindFirstChild("Torso")
  358. Player = Players:GetPlayerFromCharacter(Character)
  359. if not CheckIfAlive() then
  360. return
  361. end
  362. Tool.Grip = Grips.Normal
  363. ToolEquipped = true
  364. end
  365.  
  366. function Unequipped()
  367. Flying = false
  368. for i, v in pairs({FlightSpin, FlightPower, FlightHold}) do
  369. if v and v.Parent then
  370. v:Destroy()
  371. end
  372. end
  373. CleanUp()
  374. Handle.Transparency = 0
  375. ToolEquipped = false
  376. end
  377.  
  378. function OnServerInvoke(player, mode, value)
  379. if player ~= Player or not ToolEquipped or not value or not CheckIfAlive() then
  380. return
  381. end
  382. end
  383.  
  384. function InvokeClient(Mode, Value)
  385. local ClientReturn = nil
  386. pcall(function()
  387. ClientReturn = ClientControl:InvokeClient(Player, Mode, Value)
  388. end)
  389. return ClientReturn
  390. end
  391.  
  392. CleanUp()
  393.  
  394. ServerControl.OnServerInvoke = OnServerInvoke
  395.  
  396. Tool.Activated:connect(Activated)
  397. Tool.Equipped:connect(Equipped)
  398. Tool.Unequipped:connect(Unequipped)
  399. end))
  400. Script3.Name = "RemovalMonitor"
  401. Script3.Parent = Script2
  402. Script3.Disabled = true
  403. table.insert(cors,sandbox(Script3,function()
  404. --Made by Luckymaxer
  405.  
  406. Model = script.Parent
  407.  
  408. Debris = game:GetService("Debris")
  409.  
  410. Removing = false
  411.  
  412. function RemoveModel()
  413. if Removing then
  414. return
  415. end
  416. local Parts = {}
  417. for i, v in pairs(Model:GetChildren()) do
  418. if v:IsA("Model") then
  419. table.insert(Parts, v)
  420. end
  421. end
  422. if #Parts == 0 then
  423. Removing = true
  424. Model.Name = ""
  425. Debris:AddItem(Model, 1)
  426. end
  427. end
  428.  
  429. Model.ChildRemoved:connect(function(Child)
  430. RemoveModel()
  431. end)
  432.  
  433. RemoveModel()
  434.  
  435.  
  436. end))
  437. LocalScript4.Name = "MouseIcon"
  438. LocalScript4.Parent = Tool0
  439. table.insert(cors,sandbox(LocalScript4,function()
  440. --Made by Luckymaxer
  441.  
  442. Mouse_Icon = "rbxasset://textures/GunCursor.png"
  443. Reloading_Icon = "rbxasset://textures/GunWaitCursor.png"
  444.  
  445. Tool = script.Parent
  446.  
  447. Mouse = nil
  448.  
  449. function UpdateIcon()
  450. if Mouse then
  451. Mouse.Icon = Tool.Enabled and Mouse_Icon or Reloading_Icon
  452. end
  453. end
  454.  
  455. function OnEquipped(ToolMouse)
  456. Mouse = ToolMouse
  457. UpdateIcon()
  458. end
  459.  
  460. function OnChanged(Property)
  461. if Property == "Enabled" then
  462. UpdateIcon()
  463. end
  464. end
  465.  
  466. Tool.Equipped:connect(OnEquipped)
  467. Tool.Changed:connect(OnChanged)
  468.  
  469. end))
  470. LocalScript5.Parent = Tool0
  471. table.insert(cors,sandbox(LocalScript5,function()
  472. --Made by Luckymaxer
  473.  
  474. Tool = script.Parent
  475. Handle = Tool:WaitForChild("Handle")
  476.  
  477. Players = game:GetService("Players")
  478. RunService = game:GetService("RunService")
  479.  
  480. Camera = game:GetService("Workspace").CurrentCamera
  481.  
  482. Animations = {}
  483. LocalObjects = {}
  484.  
  485. ServerControl = Tool:WaitForChild("ServerControl")
  486. ClientControl = Tool:WaitForChild("ClientControl")
  487.  
  488. Rate = (1 / 60)
  489.  
  490. CameraSpeed = {
  491. X = 40,
  492. Z = 60
  493. }
  494.  
  495. Controls = {
  496. Forward = {
  497. Mode = false,
  498. Keys = {Key = "w", ByteKey = 17}
  499. },
  500. Backward = {
  501. Mode = false,
  502. Keys = {Key = "s", ByteKey = 18}
  503. },
  504. Left = {
  505. Mode = false,
  506. Keys = {Key = "a", ByteKey = 20}
  507. },
  508. Right = {
  509. Mode = false,
  510. Keys = {Key = "d", ByteKey = 19}
  511. },
  512. }
  513.  
  514. ToolEquipped = false
  515.  
  516. function HandleFlightControl()
  517. if not CheckIfAlive() then
  518. return
  519. end
  520. if FightMonitor then
  521. FightMonitor:disconnect()
  522. end
  523. FightMonitor = Torso.ChildAdded:connect(function(Child)
  524. if Flying then
  525. return
  526. end
  527. if Child.Name == "FlightHold" then
  528. local FlightSpin = Torso:FindFirstChild("FlightSpin")
  529. local FlightPower = Torso:FindFirstChild("FlightPower")
  530. local FlightHold = Torso:FindFirstChild("FlightHold")
  531. if not FlightSpin or not FlightPower or not FlightHold then
  532. return
  533. end
  534. Flying = true
  535. Humanoid.WalkSpeed = 0
  536. Humanoid.PlatformStand = true
  537. Humanoid.AutoRotate = false
  538. DisableJump(true)
  539. Torso.Velocity = Vector3.new(0, 0, 0)
  540. Torso.RotVelocity = Vector3.new(0, 0, 0)
  541. while Flying and FlightSpin.Parent and FlightPower.Parent and FlightHold.Parent and CheckIfAlive() do
  542. local NewPush = Vector3.new(0, 0, 0)
  543. local ForwardVector = Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(0, 0, -1))
  544. local SideVector = Camera.CoordinateFrame:vectorToWorldSpace(Vector3.new(-1, 0, 0))
  545. NewPush = (NewPush + (((Controls.Forward.Mode and not Controls.Backward.Mode) and (ForwardVector * CameraSpeed.Z)) or ((not Controls.Forward.Mode and Controls.Backward.Mode) and (ForwardVector * CameraSpeed.Z * -1)) or NewPush))
  546. NewPush = (NewPush + (((Controls.Left.Mode and not Controls.Right.Mode) and (SideVector * CameraSpeed.X)) or ((not Controls.Left.Mode and Controls.Right.Mode) and (SideVector * CameraSpeed.X * -1)) or NewPush))
  547. FlightSpin.cframe = CFrame.new(Vector3.new(0, 0, 0), ForwardVector)
  548. if NewPush.magnitude < 1 then
  549. FlightHold.maxForce = Vector3.new(FlightHold.P, FlightHold.P, FlightHold.P)
  550. FlightPower.maxForce = Vector3.new(0, 0, 0)
  551. FlightHold.position = Torso.Position
  552. else
  553. FlightHold.maxForce = Vector3.new(0, 0, 0)
  554. FlightPower.maxForce = Vector3.new((FlightPower.P * 100), (FlightPower.P * 100), (FlightPower.P * 100))
  555. end
  556. FlightPower.velocity = NewPush
  557. wait(Rate)
  558. end
  559. Flying = false
  560. if CheckIfAlive() then
  561. Torso.Velocity = Vector3.new(0, 0, 0)
  562. Torso.RotVelocity = Vector3.new(0, 0, 0)
  563. Humanoid.WalkSpeed = 16
  564. Humanoid.PlatformStand = false
  565. Humanoid.AutoRotate = true
  566. DisableJump(false)
  567. Humanoid:ChangeState(Enum.HumanoidStateType.Freefall)
  568. end
  569. end
  570. end)
  571. end
  572.  
  573. function SetAnimation(mode, value)
  574. if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
  575. for i, v in pairs(Animations) do
  576. if v.Animation == value.Animation then
  577. v.AnimationTrack:Stop()
  578. table.remove(Animations, i)
  579. end
  580. end
  581. local AnimationTrack = Humanoid:LoadAnimation(value.Animation)
  582. table.insert(Animations, {Animation = value.Animation, AnimationTrack = AnimationTrack})
  583. AnimationTrack:Play(value.FadeTime, value.Weight, value.Speed)
  584. elseif mode == "StopAnimation" and value then
  585. for i, v in pairs(Animations) do
  586. if v.Animation == value.Animation then
  587. v.AnimationTrack:Stop()
  588. table.remove(Animations, i)
  589. end
  590. end
  591. end
  592. end
  593.  
  594. function DisableJump(Boolean)
  595. if PreventJump then
  596. PreventJump:disconnect()
  597. end
  598. if Boolean then
  599. PreventJump = Humanoid.Changed:connect(function(Property)
  600. if Property == "Jump" then
  601. Humanoid.Jump = false
  602. end
  603. end)
  604. end
  605. end
  606.  
  607. function CheckIfAlive()
  608. return (((Character and Character.Parent and Humanoid and Humanoid.Parent and Humanoid.Health > 0 and Torso and Torso.Parent and Player and Player.Parent) and true) or false)
  609. end
  610.  
  611. function KeyPress(Key, Down)
  612. local Key = string.lower(Key)
  613. local ByteKey = string.byte(Key)
  614. for i, v in pairs(Controls) do
  615. if Key == v.Keys.Key or ByteKey == v.Keys.ByteKey then
  616. Controls[i].Mode = Down
  617. end
  618. end
  619. end
  620.  
  621. function Equipped(Mouse)
  622. Character = Tool.Parent
  623. Player = Players:GetPlayerFromCharacter(Character)
  624. Humanoid = Character:FindFirstChild("Humanoid")
  625. Torso = Character:FindFirstChild("Torso")
  626. ToolEquipped = true
  627. if not CheckIfAlive() then
  628. return
  629. end
  630. Mouse.KeyDown:connect(function(Key)
  631. KeyPress(Key, true)
  632. end)
  633. Mouse.KeyUp:connect(function(Key)
  634. KeyPress(Key, false)
  635. end)
  636. Spawn(HandleFlightControl)
  637. end
  638.  
  639. function Unequipped()
  640. Flying = false
  641. LocalObjects = {}
  642. for i, v in pairs(Animations) do
  643. if v and v.AnimationTrack then
  644. v.AnimationTrack:Stop()
  645. end
  646. end
  647. for i, v in pairs({PreventJump, FightMonitor}) do
  648. if v then
  649. v:disconnect()
  650. end
  651. end
  652. for i, v in pairs(Controls) do
  653. Controls[i].Mode = false
  654. end
  655. Animations = {}
  656. ToolEquipped = false
  657. end
  658.  
  659. function InvokeServer(mode, value)
  660. local ServerReturn
  661. pcall(function()
  662. ServerReturn = ServerControl:InvokeServer(mode, value)
  663. end)
  664. return ServerReturn
  665. end
  666.  
  667. function OnClientInvoke(mode, value)
  668. if mode == "PlayAnimation" and value and ToolEquipped and Humanoid then
  669. SetAnimation("PlayAnimation", value)
  670. elseif mode == "StopAnimation" and value then
  671. SetAnimation("StopAnimation", value)
  672. elseif mode == "PlaySound" and value then
  673. value:Play()
  674. elseif mode == "StopSound" and value then
  675. value:Stop()
  676. end
  677. end
  678.  
  679. ClientControl.OnClientInvoke = OnClientInvoke
  680. Tool.Equipped:connect(Equipped)
  681. Tool.Unequipped:connect(Unequipped)
  682. end))
  683. Animation6.Name = "Sit"
  684. Animation6.Parent = Tool0
  685. Animation6.AnimationId = "http://www.roblox.com/asset/?id=225279725"
  686. for i,v in pairs(mas:GetChildren()) do
  687. v.Parent = game:GetService("Players").LocalPlayer.Backpack
  688. pcall(function() v:MakeJoints() end)
  689. end
  690. mas:Destroy()
  691. for i,v in pairs(cors) do
  692. spawn(function()
  693. pcall(v)
  694. end)
  695. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement