Is there a way to add a whitelist to what is ignored with invisicam?

Hello once again, DevForums! On the last post, I questioned about whether I could make hats be ignored by invisicam, since I didn’t want it to be made transparent. I searched for solutions on the DevForums and the Developer Hub, but it yielded no solutions. This time, I am wondering if specific parts can be ignored by invisicam or if invisicam can have a “Whitelist” sort of system, since I think it can help me find a solution to making hats be ignored by invisicam. I am also using the invisicam module found inside the playerscripts inside the player in the player folder.

I don’t think it’s possible with the default PlayerModule, however you can create a Fork of it to achieve the effects you’re looking for. I’ve only looked into it a bit, however right off the bat it seems like somewhere around line 461 of PlayerModule>CameraModule>Invisicam is what you’re wanting. Here it sets the ignoreList for the rays it casts which by default includes only the Character instance.

When I tried to put a part to ignore for the ignoreList, it did not work and instead returned an error.

The part I wanted to ignore was an example part named part 1, which I inputted in:

local ignoreList = {self.char, game.Workspace.Part1}

The error it returned with:

RunService:fireRenderStepEarlyFunctions unexpected error while invoking callback: Part1 is not a valid member of Workspace "Workspace"
Part1 is not a valid member of Workspace "Workspace"

Try to reference it with workspace.Part1 vs game.Workspace.Part1.

I ran the same experiment and got successful results:

A possible solution to the overall problem may be Tagging the Handle instance of Hats with an Ignore tag and using the CollectionService to reference all hats and insert self.char as well to create the full ignoreList.

By referencing it with workspace.Part1 and not game.Workspace.Part1, it worked. I am however unsure on how to tag the handle of the hats and use it later with the collection service for the ignoreList. Would you be able to tell me how I would do it or link tutorials on how to do this?

If you wanted to whitelist all accessories and not just hats you could use Humanoid:GetAccessories(), if you’re wanting just hats specifically I’d check if the Handle has either a HairAttachment or HatAttachment before tagging it.

Assuming you can compromise by whitelisting all accessories though, you can do something like this:

local CollectionService = game:GetService("CollectionService")

game.Players.PlayerAdded:Connect(function(Player)
    Player.CharacterAppearanceLoaded:Connect(function(Char)
        local humanoid = Char:WaitForChild("Humanoid")

        local Accessories = humanoid:GetAccessories()
        for _, v in pairs(Accessories) do
            CollectionService:AddTag(v.Handle, "InvisicamIgnore")
        end
    end)
end)

You’ll then set up a variable for CollectionService in the InvisicamModule as well, and change the ignore list line to this:

local ignoreList = CollectionService:GetTagged("InvisicamIgnore")
table.insert(ignoreList, self.char)

I believe that should do the trick but I haven’t personally tested it. Hope this helps out!

1 Like

Thank you so much for your cooperation! The script works and all hats that are tagged with InvisicamIgnore will no longer phase through!

1 Like