Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 9 years ago

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

Log in to vote
0
Answered by
SurVur 86
9 years ago
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

0
:D This is what I needed. Have to modify it a bit. Thank you so much SurVur! thedarkdays152 0 — 9y
Ad

Answer this question