Hi,

I am creating a drag tool to drag a bunch of parts at the same time using the Dragger object. This is my code:

--local dragger= Instance.new("Dragger",game.Players.LocalPlayer.PlayerGui)
local dragger= Instance.new("Dragger")

tool= script.Parent
local Plr= game.Players.LocalPlayer
local Mouse= Plr:GetMouse()
local Char = Plr.Character or Plr.CharacterAdded:wait()
while game.Players.LocalPlayer.Character.Parent == nil do
	game.Players.LocalPlayer.Character.AncestryChanged:wait()
end

local mouseDown= false

tool.Equipped:connect(function()--tool.Equipped
	dragger= Instance.new("Dragger")
	mouseDown= true
	example= script.Parent:FindFirstChildWhichIsA("Model"):Clone()
	example.Parent= game.Workspace
	example:MoveTo(Vector3.new(Mouse.Hit.X,Mouse.Hit.Y,Mouse.Hit.Z))

	local list= {}
	for index,descendant in pairs(script.Parent:FindFirstChildWhichIsA("Model"):GetDescendants()) do
		if descendant:IsA("Part") then
			table.insert(list,descendant)
		end
	end	
	--]]
	--local list= example:GetChildren()
	
	dragger:MouseDown(example.PrimaryPart,example.PrimaryPart.Position-Mouse.Hit.p,list)	
	
	Mouse.Move:connect(function()
		if mouseDown== true then
			
			dragger:MouseMove(Mouse.UnitRay)
		end
	end)
end)

tool.Activated:connect(function()
	--
end)

tool.Unequipped:connect(function()--tool.Unequipped
	if mouseDown== true then	
		mouseDown= false
		dragger:MouseUp()
		example:Destroy()
	end
end)

tool.Deactivated:connect(function()

end)

I think it's a formatting or syntax issue and I tried to add braces around {list} but this is a bizarre error, and it spawned a different error when I attempted it. The name of the original error I'm currently working with is in the Title. I could try reformatting making the table, such as:

	local list = example:GetDescendants()
	for i=1,#list do
		if not list[i]:IsA('Part') then
			table.remove(list,i)
		end
	end	

So what this does is that it gets all the parts in the model called 'example.' It does not discriminate between which are actually parts and which are objects such as scripts or seats. Next, I make a for loop to go through the list and delete entries for objects that are not parts; finally this list is added in a line of code below it. Oh and by the way, the error is in the line with dragger:MouseDown(example.PrimaryPart,example.PrimaryPart.Position-Mouse.Hit.p,list)

Thanks,

Houlardy

img