Grabbing system breaks when grabbing a part with another part welded to it

i am creating a grabbing system where when you press e, it triggers a remote event which calls a grabbing function, it works fine, but however, fi you try to grab a part with ANOTHER part inside it, welded to it, with cancollide false, and anchored false, it breaks.

So what happened is whenever you grab it, it will grab the main part perfectly fine but the part inside it glitches like this:

if you cant read the small text, the apple is the part inside, and the mug is the main part

when not grabbed, the apple is on the mug, which is what i want it to do

heres the script:

-- the remote event script that calls the function

grabevent.OnServerEvent:Connect(function(player, input)
	local amountofgrabbables = grabbablefolder:GetChildren()
	for i = 1, #amountofgrabbables do
		local grabbable = amountofgrabbables[i]
		local distance = (head.Position - grabbable.Position).Magnitude
		if distance < 10 then
			Grab(grabbable)
		end
	end
end)

-- the function

local function Grab(Part)
	if isgrabbing == false then
		isgrabbing = true
		if Part.CanCollide == true then
			if Part.Anchored == false then
				grabanim:Play()
				Part.Parent = grabbingfolder
				Weld(Part, grip)
				local Gui = Part:FindFirstChild("EventFrame")
				if Gui then
					Gui.Enabled = false
				end
			end
		end
	end
end


these are only the grabbing script parts of the code

and no errors on the output

Is there any welds from the apple or mug?

the apple inside the mug is welded to the mug, too

1 Like

I guess it’s because apple is ancohred?

Try to make this when grabbing something:

for i,v in pairs(grabbedItem:GetChildren()) do
	if v:IsA("Weld") or v:IsA("WeldConstraint") then
		v.Part0.Anchored = false
		v.Part1.Anchored = false
	end
end

This script makes that so all parts that welded to mug unanchoring.

Oops, haven’t read all. Sorry.

oh shoot, i accidentally copied and pasted the wrong code at the top, ill edit that

I STILL havent found the solution to this yet