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

Is there any way to search a object names based off userId? (only part of the name is the id)

I have names some objects in my game as there userId then the name of the object. I thought this would help me track but I am not sure how I would find them based off the userId. I thought it would be with string.sub or string.len but I cant find a way to get it to work.

1 answer

stuff = game.Workspace:GetChildren()
--or wherever you have your objects
TableOfStuff

for _,v in ipairs(stuff) do
	if v.Name:find(tostring(PlayerUserId)) then
		table.insert(TableOfStuff, v)
	end
end)

return TableOfStuff

I am assuming that you know what the userId is

1 comment

0

:D This is what I needed. Have to modify it a bit. Thank you so much SurVur!

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