Help creating grappling hook

Recently, I started trying to make a grappling hook, so I made a simple script that some what works but I want to improve it such as making it stop when you reach your mouse position and smoother moving but I just don’t know how, here are my scripts:

server script:

script.Parent.OnServerEvent:Connect(function(plr,target,hit)
	local char = plr.Character
	local root = char.HumanoidRootPart
	local hum = char.Humanoid
	local bv = Instance.new("BodyVelocity")
	bv.MaxForce = Vector3.new(math.huge,math.huge,math.huge)
	bv.Velocity = hit.lookVector *50
	bv.Parent = root
end)

And Heres the local script in starter character scripts

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

mouse.Button1Down:Connect(function()
	if mouse.Target ~= nil then
		script.OdmScript:FireServer(mouse.Target,mouse.Hit)
	end
end)
repeat wait(0.1) until root.Position == hit
bv:Destroy()

Haven’t tested, lmk what happens.

Doesn’t seem to be working probably since hit is referring to mouse.Hit

Hmmmm try this in the local script:

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()

mouse.Button1Down:Connect(function()
	if mouse.Target then
		local Info = TweenInfo.new(5)
		local Tween = game:GetService("TweenService"):Create(plr.Character.HumanoidRootPart,Info,
		{CFrame = CFrame.new(mouse.Hit.x, mouse.Hit.y + 5, mouse.Hit.z)})
		Tween:Play()
	end
end)

I ended up using a touch event but I’m not sure if this is the most efficent
(In the server script)

	for i,v in pairs(char:GetChildren()) do
		if v:IsA("Part") or v:IsA("MeshPart") or v:IsA("BasePart") then
			v.Touched:Connect(function(hit)
				if hit == target or hit.Parent == target then
					bv:Destroy()
				end
			end)
		end
	end

I found a better solution that does it smoothly:

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

function getRoot(character)
	local rootPart = character:FindFirstChild('HumanoidRootPart') or character:FindFirstChild('Torso') or character:FindFirstChild('UpperTorso')
	return rootPart
end

mouse.Button1Down:Connect(function()
	if mouse.Target then
	
		local character = player.characteracter
		if character and getRoot(character) then
			game:GetService("TweenService"):Create(getRoot(player.characteracter), TweenInfo.new(1, Enum.EasingStyle.Linear), {CFrame = CFrame.new(mouse.Hit.x, mouse.Hit.y + 5, mouse.Hit.z)}):Play()
		end
	end
end)