Advertisement
DrawingJhon

Fling Tool

Aug 24th, 2022 (edited)
1,004
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.35 KB | None | 0 0
  1. local whitelist = {"PlayerModule"; "ChatScript"; "PlayerScriptsLoader"; "RbxCharacterSounds"; "BubbleChat";}
  2.  
  3. local RunService = game:GetService("RunService")
  4. local UIS = game:GetService("UserInputService")
  5. local LocalPlayer = game:GetService("Players").LocalPlayer
  6. local Mouse = LocalPlayer:GetMouse()
  7.  
  8. -- Removing anti-exploit stuff
  9.  
  10. for i, v in pairs(LocalPlayer.PlayerScripts:GetChildren()) do
  11.     if not table.find(whitelist, v.Name) then
  12.         v:Destroy()
  13.     end
  14. end
  15.  
  16. --
  17.  
  18. wait()
  19.  
  20. local Tool = LocalPlayer.Character:FindFirstChildOfClass("Tool")
  21. local Part = Tool:FindFirstChild("Handle") or Tool:FindFirstChildOfClass("MeshPart")
  22. Part:BreakJoints()
  23.  
  24. Tool.Parent = workspace
  25.  
  26. local bav = Instance.new("BodyAngularVelocity")
  27. bav.MaxTorque = Vector3.new(1, 1, 1) * math.huge
  28. bav.P = math.huge
  29. bav.AngularVelocity = Vector3.new(0, 9e5, 0)
  30. bav.Parent = Part
  31.  
  32. local bv = Instance.new("BodyVelocity")
  33. bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  34. bv.Velocity = Vector3.new()
  35. bv.Parent = Part
  36.  
  37. local Control = Instance.new("Tool")
  38. Control.Name = "Control Fling"
  39. Control.RequiresHandle = false
  40. Control.CanBeDropped = false
  41. Control.Parent = LocalPlayer.Backpack
  42.  
  43. local heart = RunService.Heartbeat:Connect(function()
  44.     Part.AssemblyLinearVelocity = Vector3.new(-30,0,0)
  45.     sethiddenproperty(LocalPlayer,"MaximumSimulationRadius",math.huge)
  46.     sethiddenproperty(LocalPlayer,"SimulationRadius",999999999)
  47. end)
  48.  
  49. --[[local inputbegan = UIS.InputBegan:Connect(function(input)
  50.     if input.UserInputType == Enum.UserInputType.MouseButton1 and Control.Parent == LocalPlayer.Character then
  51.         Part.Position = Mouse.Hit.p
  52.     end
  53. end)]]
  54.  
  55. local function GetMouseHit()
  56.     local unitRay = Mouse.UnitRay
  57.     local raycastParams = RaycastParams.new()
  58.     raycastParams.FilterDescendantsInstances = {LocalPlayer.Character, Tool}
  59.     raycastParams.FilterType = "Blacklist"
  60.     return workspace:Raycast(unitRay.Origin, unitRay.Direction * 999999, raycastParams)
  61. end
  62.  
  63. local step = RunService.Stepped:Connect(function()
  64.     local ray = GetMouseHit()
  65.     if Control.Parent == LocalPlayer.Character and ray and ray.Position then
  66.         Part.Position = ray.Position
  67.     end
  68.     Part.CanCollide = false
  69. end)
  70.  
  71. local changed = Tool.Changed:Connect(function()
  72.     if not Tool:IsDescendantOf(workspace) then
  73.         heart:Disconnect()
  74.         step:Disconnect()
  75.         changed:Disconnect()
  76.         inputbegan:Disconnect()
  77.     end
  78. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement