m9aari

Fling script

Aug 11th, 2024
14,997
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.63 KB | None | 0 0
  1. -- fling player gui
  2.  
  3. local Players = game:GetService("Players")
  4. local Player = Players.LocalPlayer
  5.  
  6. local ScreenGui = Instance.new("ScreenGui")
  7. local Frame = Instance.new("Frame")
  8. local TextBox = Instance.new("TextBox")
  9. local TextButton = Instance.new("TextButton")
  10.  
  11. ScreenGui.Parent = Player:WaitForChild("PlayerGui")
  12. ScreenGui.ResetOnSpawn = false
  13.  
  14. Frame.Parent = ScreenGui
  15. Frame.BackgroundColor3 = Color3.fromRGB(33, 33, 33)
  16. Frame.Position = UDim2.new(0.5, -100, 0.5, -50)
  17. Frame.Size = UDim2.new(0, 200, 0, 100)
  18. Frame.Active = true
  19. Frame.Draggable = true
  20.  
  21. TextBox.Parent = Frame
  22. TextBox.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
  23. TextBox.Position = UDim2.new(0.1, 0, 0.2, 0)
  24. TextBox.Size = UDim2.new(0.8, 0, 0.2, 0)
  25. TextBox.Font = Enum.Font.SourceSans
  26. TextBox.PlaceholderText = "Enter username"
  27. TextBox.Text = ""
  28. TextBox.TextColor3 = Color3.fromRGB(0, 0, 0)
  29. TextBox.TextSize = 14
  30.  
  31. TextButton.Parent = Frame
  32. TextButton.BackgroundColor3 = Color3.fromRGB(255, 0, 0)
  33. TextButton.Position = UDim2.new(0.1, 0, 0.5, 0)
  34. TextButton.Size = UDim2.new(0.8, 0, 0.4, 0)
  35. TextButton.Font = Enum.Font.SourceSans
  36. TextButton.Text = "FLING!"
  37. TextButton.TextColor3 = Color3.fromRGB(255, 255, 255)
  38. TextButton.TextSize = 20
  39.  
  40. local function GetPlayer(Name)
  41. Name = Name:lower()
  42. for _, x in next, Players:GetPlayers() do
  43. if x ~= Player then
  44. if x.Name:lower():match("^" .. Name) or x.DisplayName:lower():match("^" .. Name) then
  45. return x
  46. end
  47. end
  48. end
  49. return nil
  50. end
  51.  
  52. local function Message(_Title, _Text, Time)
  53. game:GetService("StarterGui"):SetCore("SendNotification", {Title = _Title, Text = _Text, Duration = Time})
  54. end
  55.  
  56. local function SkidFling(TargetPlayer)
  57. local Character = Player.Character
  58. local Humanoid = Character and Character:FindFirstChildOfClass("Humanoid")
  59. local RootPart = Humanoid and Humanoid.RootPart
  60.  
  61. local TCharacter = TargetPlayer.Character
  62. local THumanoid = TCharacter and TCharacter:FindFirstChildOfClass("Humanoid")
  63. local TRootPart = THumanoid and THumanoid.RootPart
  64. local THead = TCharacter and TCharacter:FindFirstChild("Head")
  65. local Accessory = TCharacter and TCharacter:FindFirstChildOfClass("Accessory")
  66. local Handle = Accessory and Accessory:FindFirstChild("Handle")
  67.  
  68. if Character and Humanoid and RootPart then
  69. if RootPart.Velocity.Magnitude < 50 then
  70. getgenv().OldPos = RootPart.CFrame
  71. end
  72. if THumanoid and THumanoid.Sit then
  73. return Message("Error Occurred", "Target is sitting", 5)
  74. end
  75. if THead then
  76. workspace.CurrentCamera.CameraSubject = THead
  77. elseif Handle then
  78. workspace.CurrentCamera.CameraSubject = Handle
  79. else
  80. workspace.CurrentCamera.CameraSubject = THumanoid
  81. end
  82. if not TCharacter:FindFirstChildWhichIsA("BasePart") then
  83. return
  84. end
  85.  
  86. local function FPos(BasePart, Pos, Ang)
  87. RootPart.CFrame = CFrame.new(BasePart.Position) * Pos * Ang
  88. Character:SetPrimaryPartCFrame(CFrame.new(BasePart.Position) * Pos * Ang)
  89. RootPart.Velocity = Vector3.new(9e7, 9e7 * 10, 9e7)
  90. RootPart.RotVelocity = Vector3.new(9e8, 9e8, 9e8)
  91. end
  92.  
  93. local function SFBasePart(BasePart)
  94. local TimeToWait = 2
  95. local Time = tick()
  96. local Angle = 0
  97.  
  98. repeat
  99. if RootPart and THumanoid then
  100. if BasePart.Velocity.Magnitude < 50 then
  101. Angle = Angle + 100
  102.  
  103. FPos(BasePart, CFrame.new(0, 1.5, 0) + THumanoid.MoveDirection * BasePart.Velocity.Magnitude / 1.25, CFrame.Angles(math.rad(Angle),0 ,0))
  104. task.wait()
  105.  
  106. FPos(BasePart, CFrame.new(0, -1.5, 0) + THumanoid.MoveDirection * BasePart.Velocity.Magnitude / 1.25, CFrame.Angles(math.rad(Angle), 0, 0))
  107. task.wait()
  108.  
  109. FPos(BasePart, CFrame.new(2.25, 1.5, -2.25) + THumanoid.MoveDirection * BasePart.Velocity.Magnitude / 1.25, CFrame.Angles(math.rad(Angle), 0, 0))
  110. task.wait()
  111.  
  112. FPos(BasePart, CFrame.new(-2.25, -1.5, 2.25) + THumanoid.MoveDirection * BasePart.Velocity.Magnitude / 1.25, CFrame.Angles(math.rad(Angle), 0, 0))
  113. task.wait()
  114.  
  115. FPos(BasePart, CFrame.new(0, 1.5, 0) + THumanoid.MoveDirection,CFrame.Angles(math.rad(Angle), 0, 0))
  116. task.wait()
  117.  
  118. FPos(BasePart, CFrame.new(0, -1.5, 0) + THumanoid.MoveDirection,CFrame.Angles(math.rad(Angle), 0, 0))
  119. task.wait()
  120. else
  121. FPos(BasePart, CFrame.new(0, 1.5, THumanoid.WalkSpeed), CFrame.Angles(math.rad(90), 0, 0))
  122. task.wait()
  123.  
  124. FPos(BasePart, CFrame.new(0, -1.5, -THumanoid.WalkSpeed), CFrame.Angles(0, 0, 0))
  125. task.wait()
  126.  
  127. FPos(BasePart, CFrame.new(0, 1.5, THumanoid.WalkSpeed), CFrame.Angles(math.rad(90), 0, 0))
  128. task.wait()
  129.  
  130. FPos(BasePart, CFrame.new(0, 1.5, TRootPart.Velocity.Magnitude / 1.25), CFrame.Angles(math.rad(90), 0, 0))
  131. task.wait()
  132.  
  133. FPos(BasePart, CFrame.new(0, -1.5, -TRootPart.Velocity.Magnitude / 1.25), CFrame.Angles(0, 0, 0))
  134. task.wait()
  135.  
  136. FPos(BasePart, CFrame.new(0, 1.5, TRootPart.Velocity.Magnitude / 1.25), CFrame.Angles(math.rad(90), 0, 0))
  137. task.wait()
  138.  
  139. FPos(BasePart, CFrame.new(0, -1.5, 0), CFrame.Angles(math.rad(90), 0, 0))
  140. task.wait()
  141.  
  142. FPos(BasePart, CFrame.new(0, -1.5, 0), CFrame.Angles(0, 0, 0))
  143. task.wait()
  144.  
  145. FPos(BasePart, CFrame.new(0, -1.5 ,0), CFrame.Angles(math.rad(-90), 0, 0))
  146. task.wait()
  147.  
  148. FPos(BasePart, CFrame.new(0, -1.5, 0), CFrame.Angles(0, 0, 0))
  149. task.wait()
  150. end
  151. else
  152. break
  153. end
  154. until BasePart.Velocity.Magnitude > 500 or BasePart.Parent ~= TargetPlayer.Character or TargetPlayer.Parent ~= Players or not TargetPlayer.Character == TCharacter or THumanoid.Sit or Humanoid.Health <= 0 or tick() > Time + TimeToWait
  155. end
  156.  
  157. workspace.FallenPartsDestroyHeight = 0/0
  158.  
  159. local BV = Instance.new("BodyVelocity")
  160. BV.Name = "EpixVel"
  161. BV.Parent = RootPart
  162. BV.Velocity = Vector3.new(9e8, 9e8, 9e8)
  163. BV.MaxForce = Vector3.new(1/0, 1/0, 1/0)
  164.  
  165. Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, false)
  166.  
  167. if TRootPart and THead then
  168. if (TRootPart.CFrame.p - THead.CFrame.p).Magnitude > 5 then
  169. SFBasePart(THead)
  170. else
  171. SFBasePart(TRootPart)
  172. end
  173. elseif TRootPart and not THead then
  174. SFBasePart(TRootPart)
  175. elseif not TRootPart and THead then
  176. SFBasePart(THead)
  177. elseif not TRootPart and not THead and Accessory and Handle then
  178. SFBasePart(Handle)
  179. else
  180. return Message("Error Occurred", "Target is missing everything", 5)
  181. end
  182.  
  183. BV:Destroy()
  184. Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, true)
  185. workspace.CurrentCamera.CameraSubject = Humanoid
  186.  
  187. repeat
  188. RootPart.CFrame = getgenv().OldPos * CFrame.new(0, .5, 0)
  189. Character:SetPrimaryPartCFrame(getgenv().OldPos * CFrame.new(0, .5, 0))
  190. Humanoid:ChangeState("GettingUp")
  191. table.foreach(Character:GetChildren(), function(_, x)
  192. if x:IsA("BasePart") then
  193. x.Velocity, x.RotVelocity = Vector3.new(), Vector3.new()
  194. end
  195. end)
  196. task.wait()
  197. until (RootPart.Position - getgenv().OldPos.p).Magnitude < 25
  198. workspace.FallenPartsDestroyHeight = getgenv().FPDH
  199. else
  200. return Message("Error Occurred", "Random error", 5)
  201. end
  202. end
  203.  
  204. TextButton.MouseButton1Click:Connect(function()
  205. local targetName = TextBox.Text
  206. local targetPlayer = GetPlayer(targetName)
  207.  
  208. if targetPlayer then
  209. SkidFling(targetPlayer)
  210. else
  211. Message("Error Occurred", "Invalid username", 5)
  212. end
  213. end)
Add Comment
Please, Sign In to add comment