RobloxScripTTPoster

(Fe) NPC Control Script hold Ctrl+ Click a npc

Dec 10th, 2022 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. -- Variables
  2. local mouse = game.Players.LocalPlayer:GetMouse()
  3. local uis = game:GetService("UserInputService")
  4.  
  5. -- Connect
  6. mouse.Button1Down:Connect(function()
  7. -- Check for Target & Left Shift
  8. if mouse.Target and uis:IsKeyDown(Enum.KeyCode.LeftControl) then
  9. local npc = mouse.target.Parent
  10. local npcRootPart = npc.HumanoidRootPart
  11. local PlayerCharacter = game:GetService("Players").LocalPlayer.Character
  12. local PlayerRootPart = PlayerCharacter.HumanoidRootPart
  13. local A0 = Instance.new("Attachment")
  14. local AP = Instance.new("AlignPosition")
  15. local AO = Instance.new("AlignOrientation")
  16. local A1 = Instance.new("Attachment")
  17. for _, v in pairs(npc:GetDescendants()) do
  18. if v:IsA("BasePart") then
  19. game:GetService("RunService").Stepped:Connect(function()
  20. v.CanCollide = false
  21. end)
  22. end
  23. end
  24. PlayerRootPart:BreakJoints()
  25. for _, v in pairs(PlayerCharacter:GetDescendants()) do
  26. if v:IsA("BasePart") then
  27. if v.Name == "HumanoidRootPart" or v.Name == "UpperTorso" or v.Name == "Head" then
  28. else
  29. v:Destroy()
  30. end
  31. end
  32. end
  33. PlayerRootPart.Position = PlayerRootPart.Position+Vector3.new(5, 0, 0)
  34. PlayerCharacter.Head.Anchored = true
  35. PlayerCharacter.UpperTorso.Anchored = true
  36. A0.Parent = npcRootPart
  37. AP.Parent = npcRootPart
  38. AO.Parent = npcRootPart
  39. AP.Responsiveness = 200
  40. AP.MaxForce = math.huge
  41. AO.MaxTorque = math.huge
  42. AO.Responsiveness = 200
  43. AP.Attachment0 = A0
  44. AP.Attachment1 = A1
  45. AO.Attachment1 = A1
  46. AO.Attachment0 = A0
  47. A1.Parent = PlayerRootPart
  48. end
  49. end)
Add Comment
Please, Sign In to add comment