Lineforce issues when making grapple hook

I’m trying to make odm gear from attack on titan and for this specific issue all you need to know is that I am attempting to make a system where when I press a button, it shoots a grapple from a compartment on my hip to the location my mouse is. The raycasting for the mouse works flawlessly and if I just assigned the position of my grapple to the position of my raycast it goes in the exact spot. I start encountering problems when I try to use lineforce to make a visual animation of it getting pulled to the location. I was using lineforce because of its simplistic style of pulling to a location. My problem stems in how when I throw my grapple, it kind of circles around the target for a bit before finally resting at the location but you can still kind of see the anchor moving a little. I also hope to later add a kind of curving animation to the beam between the attachment and the anchor while it heads toward the target. I don’t know if there’s any services that can help with that but any help would be appreciated. Here’s my code.

local RS = game:GetService("ReplicatedStorage")
local TweenService = game:GetService("TweenService")


RS.Events.Shoot.OnServerEvent:Connect(function(player, RaycastResult, hook)
	local target,position = RaycastResult["instance"],RaycastResult["position"]
	print(target)
	print(position)
	target.Color = Color3.new(1,0,0)
	hook:BreakJoints()
	local LineForce = Instance.new("LineForce", workspace)
	local TargetAttachment = Instance.new("Attachment", target)
	TargetAttachment.WorldPosition = position
	LineForce.Attachment0 = hook.ShootAttachment
	LineForce.Attachment1 = TargetAttachment
	hook.CanCollide = true
	LineForce.Magnitude = 200
end)

In this code Raycast result contains target, which is the part the ray hit, and position which is the exact point the ray hit. Hook is the anchor part. Shoot attachment is an attachment located at the tip of the hook.

1 Like