Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. local players = game:GetService("Players")
  2. local replicatedstorage = game:GetService("ReplicatedStorage")
  3. local events = replicatedstorage.Events
  4. repeat wait() until players.LocalPlayer
  5. local player = players.LocalPlayer
  6. local char = player.Character
  7. local mouse = player:GetMouse()
  8.  
  9. local currentPart
  10.  
  11. function controlPart()
  12. if not mouse.Target.Anchored then
  13. currentPart = mouse.Target
  14. local bp = Instance.new("BodyPosition")
  15. bp.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  16. bp.P = 10000
  17. bp.Parent = currentPart
  18.  
  19. while wait() do
  20. if currentPart ~= nil then
  21. bp.Position = (mouse.Hit.p - char.Torso.CFrame.p).unit*300
  22. end
  23. end
  24. end
  25. end
  26.  
  27. mouse.KeyDown:connect(function(key)
  28. if key == "f" then
  29. controlPart()
  30. elseif key == "p" then
  31. currentPart = nil
  32. end
  33. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement