1 | |
2 | |
3 | local Config = { |
4 | FlingHotkey = "E", |
5 | TpBackHotkey = "Q", |
6 | Permanent = false |
7 | } |
8 | |
9 | local Players = game:GetService("Players") |
10 | local UserInputService = game:GetService("UserInputService") |
11 | |
12 | local Player = Players.LocalPlayer |
13 | |
14 | local Character = Player.Character |
15 | local Humanoid = Character:FindFirstChildWhichIsA("Humanoid") |
16 | local RootPart = Humanoid.RootPart |
17 | |
18 | for _, x in next, Config do |
19 | if type(x) == "string" then |
20 | Config[_] = x:upper() |
21 | end |
22 | end |
23 | |
24 | local CurrentPos |
25 | local Connection |
26 | |
27 | Connection = UserInputService.InputBegan:Connect(function(Key, Typing) |
28 | if not Typing then |
29 | if Key.KeyCode == Enum.KeyCode[Config.FlingHotkey] then |
30 | if Config.Permanent then |
31 | if Player.Character.Humanoid.RootPart.Velocity.Magnitude <= 20 then |
32 | CurrentPos = Player.Character.Humanoid.RootPart.CFrame |
33 | end |
34 | Player.Character.Humanoid.RootPart.Velocity = (Player.Character.Humanoid.RootPart.Velocity + Vector3.new(0, 150, 0)) + (workspace.CurrentCamera.CFrame.LookVector * 200) |
35 | Player.Character.Humanoid:ChangeState("FallingDown") |
36 | |
37 | else |
38 | if RootPart.Velocity.Magnitude <= 20 then |
39 | CurrentPos = RootPart.CFrame |
40 | end |
41 | RootPart.Velocity = (RootPart.Velocity + Vector3.new(0, 150, 0)) + (workspace.CurrentCamera.CFrame.LookVector * 200) |
42 | Humanoid:ChangeState("FallingDown") |
43 | |
44 | end |
45 | elseif Key.KeyCode == Enum.KeyCode[Config.TpBackHotkey] then |
46 | if CurrentPos then |
47 | if Config.Permanent then |
48 | if Player.Character.Humanoid.RootPart.Velocity.Magnitude >= 20 then |
49 | Player.Character.Humanoid.RootPart.Velocity = Vector3.new() |
50 | Player.Character.Humanoid.RootPart.RotVelocity = Vector3.new() |
51 | Player.Character.Humanoid.RootPart.CFrame = CurrentPos |
52 | Player.Character.Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) |
53 | end |
54 | else |
55 | if RootPart.Velocity.Magnitude >= 20 then |
56 | RootPart.Velocity = Vector3.new() |
57 | RootPart.RotVelocity = Vector3.new() |
58 | RootPart.CFrame = CurrentPos |
59 | Humanoid:ChangeState(Enum.HumanoidStateType.GettingUp) |
60 | end |
61 | end |
62 | end |
63 | end |
64 | end |
65 | end) |
66 | |
67 | if not Config.Permanent then |
68 | Humanoid.Died:Connect(function() |
69 | Connection:Disconnect() |
70 | end) |
71 | end |