Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is it better to use tostring() or Instance.Name?

Just to get the best practice possible, but let's say I would like to make "Part" a variable, is it best to do local Part = Part.Name or local Part = tostring(Part)?

1 comment

3

part.Name.

2 answers

✓ Accepted answer

.Name. tostring isn't necessary in most cases. They both work, however.

Generally i would prefer to use Part.Name instead of tostring(Part) for the same reason people use fori,v in in next, tbl do instead of for i,v in pairs(tbl). The reason is that Part.Name is shorter than tostring(Part), by 4 characters.

The second reason that I recommend Part.Name instead of tostring(Part) is because Part.Name makes a bit more sense than tostring(Part) . For Part.Name gets the name property of the part, and tostring(Part) converts an object into a string

1 comment

0

Damn I want to accept this but I read the first one and did that sorry man

This discussion is preserved as it was. New answers, comments, and votes are closed.