The player freezes in the air when grappling. How do I stop this
> repeat wait() until game.Players.LocalPlayer.Character.HumanoidRootPart
> local Player = game.Players.LocalPlayer
> local c = Player.Character
> local origin = game.Players.LocalPlayer.Character.HumanoidRootPart.Position
> local mouse = Player:GetMouse()
> local ropeenabled = false
>
> mouse.Button1Down:Connect(function()
> local point = mouse.Hit.p
> local distance = (origin - point).magnitude -- (studs) can also be a constant such as 100
> local direction = (point - origin).unit * 500
> local raycastResult = workspace:Raycast(origin, direction)
> print("sendray")
> if ropeenabled == false then
> if raycastResult then
> ropeenabled = true
> print(raycastResult.Position)
> local attachment0 = Instance.new("Attachment",mouse.Target)
>
> attachment0.Visible = true
> local attachment1 = Instance.new("Attachment",c["Right Arm"])
>
> attachment1.Visible = true
> attachment0.WorldPosition = point
> attachment1.WorldPosition = (c["Right Arm"].CFrame*CFrame.new(0,-1,0)).Position
> local rope = Instance.new("RopeConstraint",workspace.Constraints)
> rope.Attachment0 = attachment0
> rope.Attachment1 = attachment1
> rope.Visible = true
> spawn(function()
> repeat wait() until ropeenabled == false
> game.Debris:AddItem(rope,0)
> end)
> end
> else
> ropeenabled = false
> end
> end)