Grapple system is not working

  1. What do you want to achieve? Keep it simple and clear!
    I’m trying to make a grapple system. When player press E, it will make the player go to the mouse point position. I’m using align position for this and it is not working.

  2. What is the issue? Include screenshots / videos if possible!
    The player just stand still when I press E, I checked that there is an alignposition in the player’s humanoid root part. and the point attachment were in Attachment0 property in alignposition but it still not working also there is no errors showing

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Tried searching but still got nothing

here’s the server script service script

local grapplespeed = 50

game:GetService("ReplicatedStorage").Grapple.OnServerEvent:Connect(function(ply, target, mousepos, normal)
	local char = ply.Character
	if char then
		
		local hum = char:WaitForChild("Humanoid")
		local animator = hum:WaitForChild("Animator")
		
		local arm = char:WaitForChild("Right Arm")
		
		local armattachment = Instance.new("Attachment")
		armattachment.Parent = arm
		armattachment.WorldPosition = arm.Position
		
		local ball = Instance.new("Part")
		ball.Parent = workspace
		ball.Size = Vector3.new(0.5,0.5,0.5)
		ball.Anchored = true
		ball.Transparency = 1
		ball.Position = mousepos
		
		local pointattachment = Instance.new("Attachment")
		pointattachment.Parent = ball
		armattachment.Parent = target
		armattachment.WorldPosition = mousepos
		
		local alignPos = Instance.new("AlignPosition")
		alignPos.ApplyAtCenterOfMass = true
		alignPos.Parent = char.HumanoidRootPart
		alignPos.Attachment0 = pointattachment
		alignPos.Mode = Enum.PositionAlignmentMode.OneAttachment
		alignPos.MaxForce = math.huge
		alignPos.MaxVelocity = math.huge
		alignPos.Responsiveness = 100
		
		local Time = ((mousepos - char.HumanoidRootPart.Position).Magnitude) / grapplespeed
		
		task.wait(Time - 0.5)
		
		pointattachment:Destroy()
		ball:Destroy()
		alignPos:Destroy()
		hum:ChangeState(Enum.HumanoidStateType.Freefall)