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

Is it possible to convert a string value to a string in a table?

Asked by
Freemium 110
10 years ago

So for example, how to I put the value C0deCakes.Name to a string in a table so it will show up like this:

example = {"C0deCakes"}

2 answers

Log in to vote
1
Answered by
HexC3D 830 Moderation Voter
10 years ago
local names = {}
game.Players.PlayerAdded:connect(function(player)
table.insert(names, player.Name)
print(table.concat(names, ''))
end)

I get the Idea of inserting players name into the table, right?

0
Will it show up as names = {"C0deCake"}? Freemium 110 — 10y
0
It puts the player who joins name onto it. HexC3D 830 — 10y
0
Yeah but will it add it like this: names = {"C0deCakes"} or this: name = {C0deCakes}? Freemium 110 — 10y
0
It prints just C0deCAkes not with "" HexC3D 830 — 10y
View all comments (2 more)
0
Would I be able to see if the players name is in the table by using a generic for to iterate through the table then say if player.Name == v? Freemium 110 — 10y
0
I guess so. HexC3D 830 — 10y
Ad
Log in to vote
1
Answered by
Merely 2122 Moderation Voter Community Moderator
10 years ago
local names = {}
table.insert(names, "C0deCakes")
0
What I mean is, how would I insert something like C0deCakes.Name's value into the table in string form? In order for my script to work, we cannot assume the name is C0deCakes, it could be someone other than me. Freemium 110 — 10y

Answer this question