Advertisement
DrawingJhon

Attach big PP

Aug 18th, 2022 (edited)
529
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.56 KB | None | 0 0
  1. local HumanDied = false
  2. local plr = game:GetService("Players").LocalPlayer
  3. local mouse = plr:GetMouse()
  4. local parts = {}
  5.  
  6. local netless = game:GetService("RunService").Heartbeat:Connect(function()
  7.     for i, v in pairs(parts) do
  8.         if v:IsA("BasePart") then
  9.             v.AssemblyLinearVelocity = Vector3.new(-30,0,0)
  10.         end
  11.     end
  12.     sethiddenproperty(plr,"MaximumSimulationRadius",math.huge)
  13.     sethiddenproperty(plr,"SimulationRadius",999999999)
  14. end)
  15.  
  16. local function create(part, parent, p, r)
  17.     local att0 = Instance.new("Attachment", part)
  18.     local att1 = Instance.new("Attachment", parent)
  19.     local alignPos = Instance.new("AlignPosition", part)
  20.     local alignOr = Instance.new("AlignOrientation", part)
  21.    
  22.     att1.Position = p or Vector3.new()
  23.     att1.Orientation = r or Vector3.new()
  24.  
  25.     alignPos.Attachment0 = att0
  26.     alignPos.Attachment1 = att1
  27.     alignPos.MaxForce = 999999999
  28.     alignPos.MaxVelocity = math.huge
  29.     alignPos.ReactionForceEnabled = false
  30.     alignPos.Responsiveness = math.huge
  31.     alignPos.RigidityEnabled = false
  32.  
  33.     alignOr.Attachment0 = att0
  34.     alignOr.Attachment1 = att1
  35.     alignOr.Responsiveness = math.huge
  36.     alignOr.MaxTorque = 999999999
  37. end
  38.  
  39. local mouse = plr:GetMouse()
  40.  
  41. function GetHit()
  42.     local unitRay = mouse.UnitRay
  43.     local params = RaycastParams.new()
  44.     params.FilterDescendantsInstances = {part, unpack(parts)}
  45.     params.FilterType = Enum.RaycastFilterType.Blacklist
  46.     local ray = workspace:Raycast(unitRay.Origin, unitRay.Direction * 99999, params)
  47.     return ray
  48. end
  49.  
  50. local part = Instance.new("Part", plr.Character)
  51. part.Size = Vector3.new(1,1,1)
  52. part.CanCollide = false
  53. part.Position = plr.Character.HumanoidRootPart.Position - Vector3.new(0, 10, 0)
  54. part.Transparency = 1
  55. local bv = Instance.new("BodyVelocity", part)
  56. bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
  57. bv.Velocity = Vector3.new()
  58.  
  59. local function AddHat(obj, pos, rot)
  60.     local handle = obj.Handle
  61.     handle:BreakJoints()
  62.     table.insert(parts, handle)
  63.     local mesh = handle:FindFirstChildOfClass("SpecialMesh")
  64.     if mesh then
  65.         mesh:Destroy()
  66.     end
  67.     create(handle, part, pos, rot)
  68. end
  69.  
  70. --AddHat(plr.Character.Hat1.Handle, Vector3.new(0, -1, -1.5))
  71. --AddHat(plr.Character["Pal Hair"].Handle, Vector3.new(0, -1, -3.5))
  72.  
  73. local stud2 = 0
  74. local stud1 = 0
  75.  
  76. for i, v in pairs(plr.Character:GetChildren()) do
  77.     if v:IsA("Accessory") and v:FindFirstChild("Handle") then
  78.         local handle = v.Handle
  79.         if handle.Size == Vector3.new(1, 1, 2) then
  80.             stud2 = stud2 + 1
  81.             AddHat(v, Vector3.new(0, -1, 0.5 - 2 * stud2))
  82.         end
  83.     end
  84. end
  85.  
  86. for i, v in pairs(plr.Character:GetChildren()) do
  87.     if v:IsA("Accessory") and v:FindFirstChild("Handle") then
  88.         local handle = v.Handle
  89.         if handle.Size == Vector3.new(1, 1, 1) then
  90.             stud1 = stud1 + 1
  91.             AddHat(v, Vector3.new(0, -1, - stud2 * 2 - stud1))
  92.         end
  93.     end
  94. end
  95.  
  96. local plrTarget = nil
  97.  
  98. local tool = Instance.new("Tool")
  99. tool.Name = "Attach PP"
  100. tool.RequiresHandle = false
  101. tool.CanBeDropped = false
  102. tool.Parent = plr.Backpack
  103.  
  104. tool.Activated:Connect(function()
  105.     local hit = GetHit()
  106.     local part = hit and hit.Instance
  107.     local target = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
  108.     if target then
  109.         plrTarget = target
  110.     end
  111. end)
  112.  
  113. local rs = game:GetService("RunService").Heartbeat:Connect(function()
  114.     local char = plrTarget and plrTarget.Character
  115.     local root = char and char:findFirstChild("HumanoidRootPart")
  116.     if root then
  117.         part.CFrame = root.CFrame
  118.     end
  119. end)
  120.  
  121. local IsAlive = true
  122.  
  123. local died; died = plr.Character.Humanoid.Died:Connect(function()
  124.     IsAlive = false
  125.     netless:Disconnect()
  126.     died:Disconnect()
  127.     rs:Disconnect()
  128. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement