Advertisement
Guest User

반물사

a guest
Jan 14th, 2025
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. local bodyvel_Name = "FlingVelocity"
  2. local userinputs = game:GetService("UserInputService")
  3. local w = game:GetService("Workspace")
  4. local r = game:GetService("RunService")
  5. local d = game:GetService("Debris")
  6. local strength = 400
  7.  
  8. w.ChildAdded:Connect(function(model)
  9. if model.Name == "GrabParts" then
  10. local part_to_impulse = model["GrabPart"]["WeldConstraint"].Part1
  11.  
  12. if part_to_impulse then
  13. print("Part found!")
  14.  
  15. local inputObj
  16. local velocityObj = Instance.new("BodyVelocity", part_to_impulse)
  17.  
  18. model:GetPropertyChangedSignal("Parent"):Connect(function()
  19. if not model.Parent then
  20. if userinputs:GetLastInputType() == Enum.UserInputType.MouseButton2 then
  21. print("Launched!")
  22. velocityObj.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  23. velocityObj.Velocity = workspace.CurrentCamera.CFrame.lookVector * strength
  24. d:AddItem(velocityObj, 1)
  25. elseif userinputs:GetLastInputType() == Enum.UserInputType.MouseButton1 then
  26. velocityObj:Destroy()
  27. print("Cancel Launch!")
  28. else
  29. velocityObj:Destroy()
  30. print("No two keys pressed!")
  31. end
  32. end
  33. end)
  34. end
  35. end
  36. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement