So, I have a script that puts a brick into the workspace. It names the brick after the player, e.g. 'Scaii_0'sOwnPart' or 'ROBLOX'sOwnPart'. But I have another script that needs to try find ANY part named like this.
so it goes something like this:
if part.name == "ANYTHINGHERE'sOwnPart"
But, I'm not sure on how to do this. How would I look if something was in a name and ingore the rest of the name?
Since you're searching for 'OwnPart and the Name property is a string, you can use string manipulation:
http://wiki.roblox.com/index.php?title=Global_namespace/String_manipulation
I'd recommend something like:
if string.find(part.Name,"sOwnPart") ~= nil
String patterns (or just plain matches) are GREAT, I tell you!
Make a search using Pairs, Next, or IPairs, then check if their name contains OwnPart.
Part.Name:match('%\'%S*') --escape character because I used apostrophes
for i, v in pairs(workspace:GetDescendants()) do if v.Name:match('%\'%S*') then --code here end end for i, v in pairs(workspace:GetDescendants()) do if v.Name:match('OwnPart') then --code here end end