Advertisement
IHATEMICROWAVEOVEN

roaet

Jun 21st, 2022
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. -- SETTINGS
  2. local RunService = game:GetService("RunService")
  3.  
  4. -- SCRIPT
  5. function Use(...)
  6. local args = {...}
  7. local Range = 50
  8.  
  9.  
  10. local p = Instance.new("Part")
  11. p.CanCollide = false
  12. p.Anchored = true
  13. p.Parent = workspace
  14. p.Position = args[1].Torso.Position
  15. -- part creation and stuff would go hear
  16. -- *here
  17. -- vvvvvvv thats the part i meade
  18.  
  19. for _, plr in pairs(game.Players:GetPlayers()) do
  20. if plr.Character:FindFirstChild("Torso") and args[1].Character:FindFirstChild("Torso") then
  21. if (args[1].Character.Torso.Position - plr.Character.Torso.Position).magnitude <= Range then
  22. coroutine.wrap(function()
  23. local attachment0 = Instance.new("Attachment")
  24. local f = Instance.new("VectorForce")
  25. f.ApplyAtCenterOfMass = true
  26. f.Force = 1000/(plr.Character.Torso.Position - args[1].Character.Torso.Position)
  27. -- Comment the above line and uncomment the below line for
  28. -- constant force regardless of distance
  29. -- f.Force = plr.Character.Torso.Position - args[1].Character.Torso.Position
  30. -- f.Force.Magnitude = whatevernumberlol
  31. f.Attachment0 = attachment0
  32. attachment0.Parent = plr.Character.Torso
  33. f.Parent = attachment0
  34. repeat
  35. plr.Character.Humanoid:SetStateEnabled(Enum.HumanoidStateType.Seated, true)
  36. until plr.Character.Humanoid:GetState() == "Seated"
  37. local mytick = 0
  38. local con
  39. con = RunService.Heartbeat:Connect(function()
  40. mytick += 1
  41. if mytick > 7 then -- 7 frames
  42. attachment0:Destroy()
  43. if f then f:Destroy() end -- how to demolish the games memory :troll:
  44. con:Disconnect()
  45. end
  46. end)
  47. end)()
  48. end
  49. end
  50. end
  51. end
  52.  
  53. return Use
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement