How to change a length of a rope constraint to a lookVector of something?

Hi guys, I am making a fishing rod. I need to solve one thing because it’s very bad right now. I am just changing the velocity of the ball to the character’s LowerTorso LookVector and the length by calculating the lure’s and ball’s magnitude but for some awkward reason, it makes the rope so big. Here’s a video:

https://streamable.com/hgod6s

And here’s my code:

local FishingRod = script.Parent;

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Ball = ReplicatedStorage:WaitForChild("Ball")

local Lure = FishingRod:WaitForChild("Lure");

local Player = game.Players.LocalPlayer;

local Mouse = Player:GetMouse();

local debounce = false;

local function on_Activated()
    
    if not debounce then
        debounce = true
    else
        return;
    end
    
    
    local NewBall = Ball:Clone();
    
    local AttachmentBall = Instance.new("Attachment");
    
    AttachmentBall.Parent = NewBall
    
    AttachmentBall.Name = "AttachmentBall";
    
    NewBall.CFrame = Lure.CFrame;
    
    local RopeConstranint = Instance.new("RopeConstraint");
    
    RopeConstranint.Visible = true;
    
    RopeConstranint.Color = BrickColor.new("Institutional white");
    
    RopeConstranint.Thickness = 0.2
    
    NewBall.Parent = FishingRod;
   
    NewBall.Velocity = Player.Character.LowerTorso.CFrame.LookVector * 20
    
    RopeConstranint.Length = (Player.Character.LowerTorso.CFrame.LookVector * 20 - Lure.Position).magnitude;
    
    delay(1, function()
        NewBall.Anchored = true
    end)
    
    RopeConstranint.Attachment0 = Lure.AttachmentLure;
    
    RopeConstranint.Attachment1 = AttachmentBall;
    
  
    
    RopeConstranint.Parent = Lure
    
    
end

FishingRod.Activated:Connect(on_Activated);

Any help would be appreciated. Thank you. :slight_smile:

I think you made a typo while calculating the magnitude.

RopeConstranint.Length = (Player.Character.LowerTorso.Position - Lure.Position).magnitude;`

No I meant he’s using the LookVector of LowerTorso to calculate the magnitude

(Player.Character.LowerTorso.CFrame.LookVector * 20 - Lure.Position).magnitude

Instead of using the position of the LowerTorso

(Player.Character.LowerTorso.Position - Lure.Position).magnitude;
3 Likes

Well, I just used a simple calculation, what I did was dividing the magnitude by the half of the lookVector range, and now I get this result:

So what seems to be the problem?

Nothing. My problem is now solved! Thanks anyway! :slight_smile: