I’m trying to create a grappler system in which, when the player clicks the left mouse button, a springconstraint is applied to the player’s left arm and where he clicked. I created the two attachment and have no problems at all. However, when I apply the springconstraint to the two attachments, the player freezes in the air.
Here’s the code.
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local character = player.Character
local att0 = Instance.new("Attachment")
local hrp = character:WaitForChild("HumanoidRootPart")
local att0 = Instance.new("Attachment")
att0.Parent = character.PrimaryPart
local mouse = player:GetMouse()
local function grappleStart()
local mousePos = mouse.Hit.Position
local att1 = Instance.new("Attachment")
att1.Parent = mouse.Target
att1.Position = mousePos
local springGrapple = Instance.new("SpringConstraint")
springGrapple.Parent = workspace
springGrapple.Attachment0 = att0
springGrapple.Attachment1 = att1
end
mouse.Button1Down:Connect(grappleStart)
How would I go about fixing this? Thanks