NekoWaifu

Untitled

Mar 12th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. local Player = game:GetService("Players").LocalPlayer;
  2. local UserInputService = game:GetService("UserInputService");
  3. local Bricks = {};
  4. local Space;
  5. local WalkInAir = false;
  6.  
  7. UserInputService.InputBegan:Connect(function(
  8. InputObject,
  9. GameProcessedEvent
  10. )
  11. if (
  12. (not GameProcessedEvent) and
  13. (InputObject.UserInputType == Enum.UserInputType.Keyboard)
  14. ) then
  15. if (InputObject.KeyCode == Enum.KeyCode.P) then
  16. for Key, Value in next, Bricks do
  17. Value:Destroy();
  18. end;
  19. elseif (InputObject.KeyCode == Enum.KeyCode.Space) then
  20. Space = true;
  21. elseif (InputObject.KeyCode == Enum.KeyCode.L) then
  22. WalkInAir = (not WalkInAir);
  23. end;
  24. end;
  25. end);
  26.  
  27. UserInputService.InputEnded:Connect(function(
  28. InputObject,
  29. GameProcessedEvent
  30. )
  31. if (
  32. (not GameProcessedEvent) and
  33. (InputObject.UserInputType == Enum.UserInputType.Keyboard)
  34. ) then
  35. if (InputObject.KeyCode == Enum.KeyCode.Space) then
  36. Space = nil;
  37. end;
  38. end;
  39. end);
  40.  
  41. local LastPosition = Vector3.new(0, 0, 0);
  42.  
  43. game:GetService("RunService").RenderStepped:Connect(function()
  44. local PositionChanged;
  45. local Torso = (
  46. Player.Character or
  47. Player.CharacterAdded:wait()
  48. ):WaitForChild("Torso");
  49. if ((Torso.Position - LastPosition).Magnitude > 0.75) then
  50. PositionChanged = true;
  51. end;
  52. if (Space or (WalkInAir and PositionChanged)) then
  53. local FlyBrick = Instance.new("Part",
  54. (
  55. Torso:GetChildren()[1] or
  56. Torso
  57. )
  58. );
  59. FlyBrick.Transparency = 1;
  60. FlyBrick.Anchored = true;
  61. FlyBrick.CFrame = (
  62. Torso.CFrame *
  63. CFrame.new(0, -2.25, 0)
  64. );
  65. FlyBrick.Size = Vector3.new(5, 0.05, 5);
  66. FlyBrick.BrickColor = BrickColor.new("Institutional white");
  67. FlyBrick.Locked = true;
  68. FlyBrick.TopSurface = Enum.SurfaceType.SmoothNoOutlines;
  69. FlyBrick.BottomSurface = FlyBrick.TopSurface;
  70. FlyBrick.RightSurface = FlyBrick.TopSurface;
  71. FlyBrick.LeftSurface = FlyBrick.TopSurface;
  72. FlyBrick.FrontSurface = FlyBrick.TopSurface;
  73. FlyBrick.BackSurface = FlyBrick.TopSurface;
  74. Bricks[#Bricks + 1] = FlyBrick;
  75. end;
  76. LastPosition = Torso.Position;
  77. end);
Add Comment
Please, Sign In to add comment