HandleAdornments don't seem interactive from plugins even when parented to CoreGui

The Wiki states…
Note: For handles to be interactive, they must be parented to a player’s PlayerGui or the CoreGui.

However, I’m not finding that to be true (or I’m doing something wrong).

My script is inside the plugin model as it should be. Scripts inside CoreGui don’t run at all. I’ve tried with Script, LocalScript and ModuleScript.

The code below will detect the adornment being added (confirmed by console), but the MouseButton1Down never fires.

local folder = game.CoreGui:WaitForChild("CPAdornments")
folder.DescendantAdded:connect(function(descendant)
	if descendant:IsA("HandleAdornment") then
		print(descendant)
		descendant.MouseButton1Down:connect(function() print("You clicked me") end)
	end
end)
1 Like

For a plugin, use a regular script.

Have you tried putting the handles inside of a ScreenGui? I know I’ve had troubles with handles before, and I usually try out that move before declaring defeat.

Well tried again with a regular script, and also tried parenting to ScreenGui, BillboardGui and SurfaceGui for kicks. No luck so far.

I’m supposing the problem lies somewhere else, then.

The following code works fine for me (tested by saving as a local plugin).

local handles = Instance.new("Handles");
handles.MouseButton1Down:connect(function()
	print("MouseButton1Down fired");
end)
handles.MouseDrag:connect(function(face, distance)
	print(string.format("MouseDrag(%s, %s) fired", tostring(face), tostring(distance)));
end)

game:GetService("Selection").SelectionChanged:connect(function()
	local adornee;
	for i, v in pairs(game:GetService("Selection"):Get()) do
		if v:IsA("BasePart") then
			adornee = v;
			break;
		end
	end
	if adornee then
		handles.Adornee = adornee;
		handles.Parent = game.CoreGui;
	else
		adornee.Parent = nil;
	end
end)

Thanks, after playing around with it I figured out that the handles have to be parented DIRECTLY UNDER game.CoreGui to be interactive and cant be under a Folder, ScreenGui or anything else within game.CoreGui, which I think is pretty silly. I was organizing into different folders under game.CoreGui to avoid having to redraw the whole thing every time an adornees position changed, but that was the problem. I wound up using CollectionService to tag each handle segment according to what section it belonged to which was a bit harder to do but got the job done.