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

Is there a way to find out if a part of the name is something?

Let's say I have several parts named "x.poop" and others named "x.boop" (x being different names for all the parts) in the same directory, would I be able to modify only the .poop ones?

Like "if part.Name == (has the .poop extension) then ..."

1 comment

0

yeah

1 answer

✓ Accepted answer

Hi radus,

You can easily do this using string.sub().

####Like this:

if string.sub(part.Name, 3, 6) == "poop" then
	print("It's poop.");
end

##Well, hope I helped and have a wonderful day/night.

Thanks,

Best regards,

~~ KingLoneCat

4 comments

0

This will take the third character and go all the way to the sixth character in the string and inclusively print that. Meaning that it will also print the 3rd and the 6th characters in the string.

0

Not print but, compare that.

0

thanks that seems to work!

0

Good.

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