Hey there! I’m making a grapple system, and I want to have a rope constraint attached to the right arm of the character, but whenever I do this it doesn’t behave how it would if I attach it to the RootPart.
Video:
https://streamable.com/52g8ym
Script (local):
local targetPosition = mouse.Hit.Position
attachment0 = Instance.new("Attachment", character["Right Arm"])
attachment1 = Instance.new("Attachment", mouse.Target)
attachment1.WorldPosition = humanoid.RootPart.Position
visualSpring = Instance.new("SpringConstraint", humanoid.RootPart)
visualSpring.Attachment0 = attachment0
visualSpring.Attachment1 = attachment1
visualSpring.Color = BrickColor.new("Really black")
visualSpring.Visible = true
local startTime = tick()
updateConnection = game:GetService("RunService").RenderStepped:Connect(function()
local elapsed = tick() - startTime
local progress = elapsed / timeToReach
if progress >= 1 then
progress = 1
updateConnection:Disconnect()
end
attachment1.WorldPosition = humanoid.RootPart.Position:Lerp(targetPosition, progress)
visualSpring.Coils = 3 * (1 - progress)
end)
How would I fix this? Any help is appreciated!