I made this rope swinging script, using rope constraints. But whenever I shoot the rope I get stuck midair, unable to move. I have no idea why. Any help please?
--// Variables local players = game:GetService("Players") local plr = players.LocalPlayer local char = plr.Character local head = char:FindFirstChild("Head") local athA = Instance.new("Attachment") local athPart = game.Workspace.AttachPart --This is a specific part that the rope attaches to local athB = Instance.new("Attachment") athB.Parent = athPart athA.Position = Vector3.new(0,0,-1) athA.Parent = head local length local uis = game:GetService("UserInputService") isSwinging = false --// Functions: uis.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.R then if isSwinging == false then isSwinging = true script.WebSound:Play() wait(0.1) rope = Instance.new("RopeConstraint") length = (head.Position - athPart.Position).magnitude rope.Attachment0 = athB rope.Attachment1 = athA rope.Length = length rope.Visible = true rope.Parent = head -- I have tried adding a HumanoidStateType here end end end) uis.InputEnded:Connect(function(key) if key.KeyCode == Enum.KeyCode.R then if isSwinging == true then rope:Destroy() isSwinging = false -- I have tried adding a HumanoidStateType here end end end)
To figure out the process of whats going on make sure you double check by playing the character and then looking if the attachment is there or not, a simple bug can be easily fixed if you look hard enough. I'm guessing you just didn't name the attachment 0 or one. Example
local athA = Instance.new("Attachment") local athPart = game.Workspace.AttachPart local athA.Name = "Attachment0"