Help with studio mouse filter

i made a plugin that gives the player their avatar in team create but whenever you try select something the hats will get in the way of your mouse and stop you from selecting objects that are behind the hats.

screenshots of the issue:


(i already tried using TargetFilter, Locked and CanQuery)

My original post:

I believe setting CanQuery = false prevents the engine from accounting it in raycasting (including the one used to get what the mouse is hovering over).

Try looping through all of your avatar parts and setting it to false, might work.

1 Like

this did not work. :confused: it still blocks the mouse.

If you’re using the legacy mouse object parent all of the accessories to a single folder instance and blacklist that from the mouse’s potential targets.

Mouse.TargetFilter = AccessoryFolder --Reference to the folder of accessories.

What I do in Team Create with Hats is create a new collision group that doesn’t collide with the default, since the mouse in studio only interacts with objects in the default group.

Here’s a little module I wrote that’s actually used in Team Create with Hats. It gets a common collision group that any plugin could theoretically use. Just drop it into a module, require it to get the collision group name, and set your objects to use that group!

local PhysicsService = game:GetService("PhysicsService")

local groupName = "Plugin_Unselectable_Group"

local function getOrCreateGroup(name)
	local ok, _ = pcall(PhysicsService.GetCollisionGroupId, PhysicsService, name)
	if not ok then
		-- Create may fail if we have hit the maximum of 32 different groups
		ok, _ = pcall(PhysicsService.CreateCollisionGroup, PhysicsService, name)
	end
	return ok
end

local didGetGroup = getOrCreateGroup(groupName)

if didGetGroup then
	PhysicsService:CollisionGroupSetCollidable("Default", groupName, false)
end

return if didGetGroup then groupName else "Default"

1 Like

yea thanks. i actualy ended up looking at your github to see how you did it. thanks anyways.