I'm working on a swing grapple hook system and I cant figure out how to swing. Please Help.

local UIS = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local tweenService = game:GetService("TweenService")
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded
local hum = char:WaitForChild("Humanoid")
local humRootPart = char:FindFirstChild("HumanoidRootPart")
local mouse = plr:GetMouse()
local cam = workspace.CurrentCamera
local hookPoint = Vector3.new(0, 0, 0)
local isGrappleHookAttached = false
local isOnWall = false
local canAttach = true
local grapplingHookLength = 15000
local isIdle = true

function grappleHookRight()
	UIS.InputBegan:Connect(function(input, gameProcessedEvent)
		if UIS:IsKeyDown(Enum.KeyCode.E) then
			
			local ray = Ray.new(humRootPart.Position, (mouse.Hit.p - humRootPart.Position).unit * 300)
			local hit, position, normal = game.Workspace:FindPartOnRay(ray, char)
			local distance = (position - humRootPart.Position).magnitude
			
			grappleRight = Instance.new("RopeConstraint", game.Workspace)
			at0 = Instance.new("Attachment", humRootPart)
			at0.Position = Vector3.new(0, 0, 0)
			at1 = Instance.new("Attachment", mouse.Target)
			at1.WorldPosition = position
			
			if hit then
				grappleRight.Thickness = 0.05
				grappleRight.Attachment0 = at0
				grappleRight.Attachment1 = at1
				grappleRight.Visible = true
				grappleRight.Enabled = true
				grappleRight.Color = BrickColor.new("Black")
				grappleRight.Length = distance
				
				runService.Heartbeat:Wait()
				local bodyPos = Instance.new("BodyPosition", humRootPart)
				bodyPos.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
				bodyPos.P = 1500
				bodyPos.Position = position
				
				UIS.InputEnded:Connect(function(input, gameProcessedEvent)
					bodyPos:Destroy()
					grappleRight:Destroy()
					at0:Destroy()
					at1:Destroy()
				end)
			end
		end
	end)
end

grappleHookRight()