Advertisement
Guest User

Untitled

a guest
May 19th, 2019
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.46 KB | None | 0 0
  1. local Settings = {
  2.  
  3. Speed = 5,
  4. SprintSpeed = 30,
  5. ToggleKey = Enum.KeyCode.LeftAlt,
  6. SprintKey = Enum.KeyCode.LeftControl,
  7.  
  8. ForwardKey = Enum.KeyCode.W,
  9. LeftKey = Enum.KeyCode.A,
  10. BackwardKey = Enum.KeyCode.S,
  11. RightKey = Enum.KeyCode.D,
  12. UpKey = Enum.KeyCode.E,
  13. DownKey = Enum.KeyCode.Q,
  14.  
  15. }
  16.  
  17. local Screen = Instance.new("ScreenGui",game.CoreGui)
  18. local Distance = Instance.new("TextLabel",Screen)
  19. Distance.BackgroundTransparency = 1
  20. Distance.Size = UDim2.new(0,10,0,10)
  21. Distance.ZIndex = 2
  22. Distance.Text = "0"
  23. Distance.TextStrokeTransparency = .5
  24. Distance.TextSize = 20
  25. Distance.TextStrokeColor3 = Color3.fromRGB(33, 33, 33)
  26. Distance.Font = Enum.Font.Gotham
  27. Distance.TextColor3 = Color3.new(1,1,1)
  28. Distance.TextXAlignment = Enum.TextXAlignment.Left
  29. Distance.TextYAlignment = Enum.TextYAlignment.Top
  30.  
  31.  
  32. local Mouse = game.Players.LocalPlayer:GetMouse()
  33. local Direction = Vector3.new(0,0,0)
  34. local InterpolatedDir = Direction
  35. local Tilt = 0
  36. local InterpolatedTilt = Tilt
  37. local RunService = game:GetService("RunService")
  38. local Toggled = false
  39. local Sprinting = false
  40. local CameraPos = game.Workspace.CurrentCamera.CFrame.Position
  41.  
  42. pcall(function()
  43. game.Players.LocalPlayer.DevCameraOcclusionMode = Enum.DevCameraOcclusionMode.Invisicam
  44. end)
  45.  
  46. function Lerp(a, b, t)
  47. return a + (b - a) * t
  48. end
  49.  
  50. local LastPos = nil
  51.  
  52. function KeyHandler(actionName, userInputState)
  53. if true and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
  54. if actionName == "Toggle" and userInputState == Enum.UserInputState.Begin then
  55. Toggled = not Toggled
  56. if Toggled then
  57. LastPos = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
  58. --game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = true
  59. game.Players.LocalPlayer.Character.Humanoid.PlatformStand = true
  60. else
  61. LastPos = nil
  62. game.Players.LocalPlayer.Character.Humanoid.PlatformStand = false
  63. --game.Players.LocalPlayer.Character.HumanoidRootPart.Anchored = false
  64. end
  65. elseif actionName == "Forward" then
  66. Tilt = userInputState == Enum.UserInputState.Begin and -20 or 0
  67. Direction = Vector3.new(Direction.x,Direction.y,userInputState == Enum.UserInputState.Begin and -1 or 0)
  68. elseif actionName == "Left" then
  69. Direction = Vector3.new(userInputState == Enum.UserInputState.Begin and -1 or 0,Direction.y,Direction.z)
  70. elseif actionName == "Backward" then
  71. Tilt = userInputState == Enum.UserInputState.Begin and 20 or 0
  72. Direction = Vector3.new(Direction.x,Direction.y,userInputState == Enum.UserInputState.Begin and 1 or 0)
  73. elseif actionName == "Right" then
  74. Direction = Vector3.new(userInputState == Enum.UserInputState.Begin and 1 or 0,Direction.y,Direction.z)
  75. elseif actionName == "Up" then
  76. Direction = Vector3.new(Direction.x,userInputState == Enum.UserInputState.Begin and 1 or 0,Direction.z)
  77. elseif actionName == "Down" then
  78. Direction = Vector3.new(Direction.x,userInputState == Enum.UserInputState.Begin and -1 or 0,Direction.z)
  79. elseif actionName == "Sprint" then
  80. Sprinting = userInputState == Enum.UserInputState.Begin
  81. end
  82. end
  83. end
  84.  
  85.  
  86.  
  87. game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
  88.  
  89. if inputObject.KeyCode == Settings.ToggleKey then
  90. KeyHandler("Toggle", Enum.UserInputState.Begin, inputObject)
  91. elseif inputObject.KeyCode == Settings.ForwardKey then
  92. KeyHandler("Forward", Enum.UserInputState.Begin, inputObject)
  93. elseif inputObject.KeyCode == Settings.LeftKey then
  94. KeyHandler("Left", Enum.UserInputState.Begin, inputObject)
  95. elseif inputObject.KeyCode == Settings.BackwardKey then
  96. KeyHandler("Backward", Enum.UserInputState.Begin, inputObject)
  97. elseif inputObject.KeyCode == Settings.RightKey then
  98. KeyHandler("Right", Enum.UserInputState.Begin, inputObject)
  99. elseif inputObject.KeyCode == Settings.UpKey then
  100. KeyHandler("Up", Enum.UserInputState.Begin, inputObject)
  101. elseif inputObject.KeyCode == Settings.DownKey then
  102. KeyHandler("Down", Enum.UserInputState.Begin, inputObject)
  103. elseif inputObject.KeyCode == Settings.SprintKey then
  104. KeyHandler("Sprint", Enum.UserInputState.Begin, inputObject)
  105. end
  106.  
  107.  
  108. end)
  109.  
  110.  
  111. game:GetService("UserInputService").InputEnded:connect(function(inputObject, gameProcessedEvent)
  112.  
  113. if inputObject.KeyCode == Settings.ToggleKey then
  114. KeyHandler("Toggle", Enum.UserInputState.End, inputObject)
  115. elseif inputObject.KeyCode == Settings.ForwardKey then
  116. KeyHandler("Forward", Enum.UserInputState.End, inputObject)
  117. elseif inputObject.KeyCode == Settings.LeftKey then
  118. KeyHandler("Left", Enum.UserInputState.End, inputObject)
  119. elseif inputObject.KeyCode == Settings.BackwardKey then
  120. KeyHandler("Backward", Enum.UserInputState.End, inputObject)
  121. elseif inputObject.KeyCode == Settings.RightKey then
  122. KeyHandler("Right", Enum.UserInputState.End, inputObject)
  123. elseif inputObject.KeyCode == Settings.UpKey then
  124. KeyHandler("Up", Enum.UserInputState.End, inputObject)
  125. elseif inputObject.KeyCode == Settings.DownKey then
  126. KeyHandler("Down", Enum.UserInputState.End, inputObject)
  127. elseif inputObject.KeyCode == Settings.SprintKey then
  128. KeyHandler("Sprint", Enum.UserInputState.End, inputObject)
  129. end
  130.  
  131.  
  132. end)
  133.  
  134.  
  135. RunService.RenderStepped:Connect(function()
  136. if Toggled and game.Players.LocalPlayer.Character and game.Players.LocalPlayer.Character:FindFirstChild("HumanoidRootPart") then
  137. for i,v in pairs(game.Players.LocalPlayer.Character:GetDescendants()) do
  138. if v:IsA("BasePart") then
  139. v.Velocity = Vector3.new(0,0,0)
  140. end
  141. end
  142. local RootPart = game.Players.LocalPlayer.Character.HumanoidRootPart
  143. if LastPos then
  144. Distance.Text = math.floor((LastPos-RootPart.Position).Magnitude+.5)
  145. if (LastPos-RootPart.Position).Magnitude >= 350 then
  146. Distance.TextColor3 = Color3.new(1,0,0)
  147. else
  148. Distance.TextColor3 = Color3.new(1,1,1)
  149. end
  150. else
  151. Distance.TextColor3 = Color3.new(1,1,1)
  152. Distance.Text = 0
  153. end
  154. InterpolatedDir = InterpolatedDir:Lerp((Direction * (Sprinting and Settings.SprintSpeed or Settings.Speed)),.2)
  155. InterpolatedTilt = Lerp(InterpolatedTilt ,Tilt* (Sprinting and 2 or 1),Tilt == 0 and .2 or .1)
  156. RootPart.CFrame = RootPart.CFrame:Lerp(CFrame.new(RootPart.Position,RootPart.Position + Mouse.UnitRay.Direction) * CFrame.Angles(0,math.rad(00),0) * CFrame.new(InterpolatedDir) * CFrame.Angles(math.rad(InterpolatedTilt),0,0),.2)
  157. else
  158. Distance.TextColor3 = Color3.new(1,1,1)
  159. Distance.Text = 0
  160. end
  161. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement