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