02:15:37.075 > print(game:GetService("CollectionService"):HasTag({}, "")) print("no error") - Studio
02:15:37.076 argument #1 expects a **string**, but **table** was passed - Edit
02:15:37.076 Stack Begin - Studio
02:15:37.076 Script 'print(game:GetService("CollectionService"):HasTag({}, "")) print("no error")', Line 1 - Studio
02:15:37.076 Stack End - Studio
When passing a string:
02:15:54.805 > print(game:GetService("CollectionService"):HasTag("", "")) print("no error") - Studio
02:15:54.806 false - Edit
02:15:54.806 no error - Edit
When passing an Instance:
02:16:06.583 > print(game:GetService("CollectionService"):HasTag(workspace, "")) print("no error") - Studio
02:16:06.584 false - Edit
02:16:06.584 no error - Edit
Expected behavior
CollectionService:HasTag’s first argument should expect an instance only but accepts a string or instance.
Ah wacky, I forgot about Instance:HasTag, however the behaviour of not erroring when a table is passed is really annoying and allowed a possible exploit in our game’s code where we assumed incorrect types would error if something different was passed in
We had plans to add an error in the past, but unfortunately it was not well received by developers relying on implicit conversions of values to strings in the API (we still allowed number->string as that was even more widely used).
We settled on displaying warnings to nudge developers, but reports show that while many experiences applied fixes, many remain with the issue.