Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Player = game:GetService("Players").LocalPlayer;
- local UserInputService = game:GetService("UserInputService");
- local Bricks = {};
- local Space;
- local WalkInAir = false;
- UserInputService.InputBegan:Connect(function(
- InputObject,
- GameProcessedEvent
- )
- if (
- (not GameProcessedEvent) and
- (InputObject.UserInputType == Enum.UserInputType.Keyboard)
- ) then
- if (InputObject.KeyCode == Enum.KeyCode.P) then
- for Key, Value in next, Bricks do
- Value:Destroy();
- end;
- elseif (InputObject.KeyCode == Enum.KeyCode.Space) then
- Space = true;
- elseif (InputObject.KeyCode == Enum.KeyCode.L) then
- WalkInAir = (not WalkInAir);
- end;
- end;
- end);
- UserInputService.InputEnded:Connect(function(
- InputObject,
- GameProcessedEvent
- )
- if (
- (not GameProcessedEvent) and
- (InputObject.UserInputType == Enum.UserInputType.Keyboard)
- ) then
- if (InputObject.KeyCode == Enum.KeyCode.Space) then
- Space = nil;
- end;
- end;
- end);
- local LastPosition = Vector3.new(0, 0, 0);
- game:GetService("RunService").RenderStepped:Connect(function()
- local PositionChanged;
- local Torso = (
- Player.Character or
- Player.CharacterAdded:wait()
- ):WaitForChild("Torso");
- if ((Torso.Position - LastPosition).Magnitude > 0.75) then
- PositionChanged = true;
- end;
- if (Space or (WalkInAir and PositionChanged)) then
- local FlyBrick = Instance.new("Part",
- (
- Torso:GetChildren()[1] or
- Torso
- )
- );
- FlyBrick.Transparency = 1;
- FlyBrick.Anchored = true;
- FlyBrick.CFrame = (
- Torso.CFrame *
- CFrame.new(0, -2.25, 0)
- );
- FlyBrick.Size = Vector3.new(5, 0.05, 5);
- FlyBrick.BrickColor = BrickColor.new("Institutional white");
- FlyBrick.Locked = true;
- FlyBrick.TopSurface = Enum.SurfaceType.SmoothNoOutlines;
- FlyBrick.BottomSurface = FlyBrick.TopSurface;
- FlyBrick.RightSurface = FlyBrick.TopSurface;
- FlyBrick.LeftSurface = FlyBrick.TopSurface;
- FlyBrick.FrontSurface = FlyBrick.TopSurface;
- FlyBrick.BackSurface = FlyBrick.TopSurface;
- Bricks[#Bricks + 1] = FlyBrick;
- end;
- LastPosition = Torso.Position;
- end);
Add Comment
Please, Sign In to add comment