Instance:FindFirstChild(number) now results in a warning

This is very self-explanatory but instance:FindFirstChild(number) now gives a warning when it never used to. These warnings are now flooding my output from both my own scripts and core scripts. This happens for every single :FindFirstChild call so it makes it difficult to look for actual warnings and errors.


For example, put this in the console and observe a warning will appear in the output:
workspace:FindFirstChild(1)

Expected behavior

Instance:FindFirstChild(number) should not result in a warning.

17 Likes

Yes, as you can see in the documentation, FindFirstChild accepts a string:
FindFirstChild(name: string, recursive: boolean): Instance

Please pass correct arguments to avoid the warning.

7 Likes

It is causing corescripts in studio to throw warnings.

3 Likes

We are in the process of fixing incorrect parameters in CoreScripts.

12 Likes

Is it going to bog down my scripts to call tostring for every findfirstchild call? We use the player’s user id for the name of their data folder so it isn’t uncommon that we’re passing a number to findfirstchild

2 Likes

If CoreScripts are not fixed in time and are too noisy, we will temporarily disable the warning report until they stop coming from Roblox scripts.

3 Likes

tostring is very performant, especially on values that are already strings.
But consider using it only when there’s a reason to expect a number as a child name (Instance.Name will return back a string after all)

5 Likes

yeah that’s correct, but it never gave this warning before so people thought it was ok, so now people have to edit thousands of scripts and instances where it’s used to get this warning to stop spamming. Wouldn’t FindFirstChild(string) just use tostring anyway since it’s performant? why add the extra step just wondering

4 Likes

I don’t see the reasoning behind this. Why randomly do this? It seems unnecessary and inconsistent,numbers are quite often automatically converted into strings when applicable (e.g. concatenation). It will just cause a bunch of warnings for no reason. Why update the engine to match the documentation instead of making the documentation match the engine?

10 Likes

Why are you attached to doing things badly?

Just because you can automatically convert a number into a string doesn’t mean it’s a good idea. I have never once had to do that for FindFirstChild. It’s actually shocking how many people are using numbers as a parameter for it.

9 Likes

lots of plugins I use are generating these warnings… these aren’t things we can just fix overnight.

7 Likes

Do you know why this just start happening? I don’t see any changes in the release notes referring to this. I completely agree that FindFirstChild should only take a string, but to have these warnings pop up without any documented change is a bit unnerving to me.

2 Likes

FYI you can automate this. What you can do is wrap the name arg of your FFC calls with tostring using a regex Find All/Replace All, or do this in lua using command bar.

This is a very quick, but very dirty solution, so do what you will with this information.

1 Like

So, can I confirm that this sudden change is now intended behaviour?

Why does it suddenly not implicitly convert a number to a string anymore?

4 Likes

I don’t appreciate this change, and it’s given me a lot of extra work to do in several projects for, as far as I can see, no benefit.

3 Likes

I am curious what the intention was with this warning- obviously you guys knew lots of devs use FindFirstChild with a number in lots of situations, or you would have made it fail rather than produce a warning.

Sure in theory users should be following documentation and converting to strings here, but out of curiosity, why this change now?
It has been convenient to index things with plr.UserId, or when iterating over a set number of things.

It just seems like a sudden change to force devs to go back through all their projects and make changes here and I’m not sure what problem this change solves?

Saving a game also causes this warning I point out.
image

4 Likes

kinda annoying having to change all scripts

cause it worked completely fine, and it’s even less to write. why you gotta be so hostile about it? relax. not everyone has the same scripting knowledge or mindset.

plus some that work on Roblox’s source code even think the same judging by the hundreds of warnings you get by just loading up the baseplate template.

7 Likes

This definetly is NOT the correct way to change the behaviour of the core functions. I do understand it’s only a warning, but it unnecessarily clogs up the output window and this started happening with no prior notice. It’s no secret that a lot of developers have found it redundant to put tostring() inside functions that automatically would handle numbers by converting them to a string. Whether this is considered a bad practice is one thing, but to suddenly change this behaviour after it has been honoured for years, without any notice, is a separate thing, and the way it was done is absolutely wrong. Let the case with CoreScripts spamming the warnings be the best reason why one should not touch any kind of core function behaviour with no information and/or grace period at all.

5 Likes

Broooo now the entire game I’m working on with a team has to be rescripted. I’ve got hundreds of ERRORS. HUNDREDS!!! IN ALL DIFFERENT LINES TOO! THIS IS SO MESSED UP BRUH. I can’t imagine manually changing all of these to add a single ‘tostring’ argument. Please reverse this change I beg you roblox!!!
gta-oh-no

4 Likes