Hey, I'm trying to build a robotic claw that can grab and move players around, and I want to use Welds to hold the player in place in the claw by creating a Weld between the Player and a certain part on the claw.
The claw moves entirely by CFrame. Here is a prototype script I made just to test out the welding. It creates the weld, and the character gets frozen in place. How do I make it so that they are just welded to the part and will move with it?
Thanks.
currentlyGrabbing = false
local weldPart = script.Parent.clawSegment.holderSpot
while true do
wait(.5)
if script.Parent.grabbing.Value == true then
print("grab is true")
--find local humanoid
local mods = workspace:getChildren()
for _,v in pairs (mods) do
if v:IsA("Model") and v:findFirstChild("Humanoid") and v:findFirstChild("Torso") and v:findFirstChild("Humanoid").Health ~= 0 and (not currentlyGrabbing) and ((v.Torso.Position - weldPart.Position).magnitude < 5) then
print("got one")
currentlyGrabbing = true
local torso = v.Torso
local newWeld = Instance.new("Weld")
newWeld.Part1 = weldPart
newWeld.Part0 = torso
newWeld.C0 = CFrame.new(0,2,0)
newWeld.Parent = torso
end
end
end
end

2 comments
Try welding to the HumanoidRootPart instead
Thanks for the suggestion, but this is a NPC/Dummy I am using that doesn't have a HumanoidRootPart