Advertisement
Guest User

Fling Things and People Script

a guest
Sep 29th, 2024
964
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. local userinputs = game:GetService("UserInputService")
  2. local action = game:GetService("ContextActionService")
  3. local w = game:GetService("Workspace")
  4. local r = game:GetService("RunService")
  5. local d = game:GetService("Debris")
  6. local strength = 400
  7. w.ChildAdded:Connect(function(model)
  8. if model.Name == "GrabParts" then
  9. local part_to_impulse = model["GrabPart"]["WeldConstraint"].Part1
  10. if part_to_impulse then
  11. print("Part found!")
  12. local inputObj
  13. local velocityObj = Instance.new("BodyVelocity", part_to_impulse)
  14. local c1, c2, c3
  15. velocityObj.MaxForce = Vector3.new(0,0,0)
  16. while inputObj == nil and model.Parent do
  17. for _, button in
  18. pairs(game.Players.LocalPlayer.PlayerGui["ContextActionGui"]:GetDescendants()) do
  19. if button:IsA("ImageLabel") then
  20. if button.Image == "http://www.roblox.com/asset/?id=9603678090" then
  21. inputObj = button.Parent
  22. print(inputObj)
  23. end
  24. end
  25. end
  26. r.Heartbeat:Wait()
  27. end
  28. if inputObj then
  29. c1 = inputObj.MouseButton1Up:Connect(function()
  30. print("Launched!")
  31. velocityObj.MaxForce = Vector3.new(math.huge,
  32. math.huge, math.huge)
  33. velocityObj.Velocity =
  34. workspace.CurrentCamera.CFrame.lookVector * strength
  35. end)
  36. c2 = inputObj.MouseButton1Down:Connect(function()
  37. print("Launched!")
  38. velocityObj.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  39. velocityObj.Velocity = workspace.CurrentCamera.CFrame.lookVector * strength
  40. end)
  41. end
  42. c3 = model:GetPropertyChangedSignal("Parent"):Connect(function()
  43. if not model.Parent then
  44. c3:Disconnect()
  45. d:AddItem(velocityObj, 1)
  46. if c1 then
  47. c1:Disconnect()
  48. if c2 then
  49. c2:Disconnect()
  50. end
  51. end
  52. end
  53. end)
  54. end
  55. end
  56. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement