Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does this Magnitude script for a grapple hook not work?

Asked by 4 years ago
function grapplee(part)
  for _, guy in pairs(workspace:GetChildren()) do
    if part.Anchored == true then return end
    if guy:IsA("Part") or guy:IsA("UnionOperation") and guy ~= chr and 5  > (guy.Position - part.Position).magnitude then
                                  local velocity = Instance.new("BodyVelocity")
    velocity.MaxForce = Vector3.new(100000, 100000, 100000)
    velocity.P = math.huge
    velocity.Velocity = Vector3.new(0,150,0) + hrp.CFrame.lookVector * 75
    velocity.Parent = chr.HumanoidRootPart
    game.Debris:AddItem(velocity , 0.25)
      end
    end
  end

The main issue with this is, the magnitude just cancels itself and it grapples the whole workspace

Answer this question