How do I add a string value to players in a table?

Hello, I was wondering how should I attach a StringValue to only players that are in a certain table. So how should I do that?

What you mean with

?

char

Whoops spelling error, lol a player.

No, no, i meant, what you mean with attaching a (STRINGVALUE) to an player?

Is there a reason you want to use a StringValue? Is it for tagging players? Instead of reinventing the wheel, use CollectionService. You can then go throught the table, tagging each player.

local CollectionService = game:GetService("CollectionService")

for _, player in ipairs(players_table) do
    CollectionService:AddTag(player, "InTable") -- or whatever tag name
end
3 Likes

So what I mean is when a player is put in a certain table then, a script is suppose to attach a StringValue to every player in that table.

In the players_table there is a error line.

That code is just meant to be an example. Not code for you to copy-paste. You said you have a table of players, and you want to tag them, so my code does just that.

1 Like

Yes I know that i’ve just never used ipairs and when using that code my table name has an error line.

Then that is an issue with how you’ve written it. Using pairs is no different from using ipairs.

1 Like

Ok thanks it worked! Thank you so mcuh!