So, I'm quite new to making tables and I am not quite sure how they work yet, so I have been doing some experimenting. I made a script using tables to try it out, but I don't know what's wrong and why it's wrong.
Code:
01 | local invis = { --table |
02 |
03 | [ "BlackKnightXx" ] = true , |
04 | [ "InfinitySoldier" ] = true |
05 |
06 | } |
07 |
08 | game.Players.PlayerAdded:connect( function (player) --player joins |
09 | wait( 5 ) --wait for character |
10 | if player.Name = = invis then --if player is on the invis table |
11 | local char = player.Character --fetching character |
12 | char.Head.Transparency = 1 --invisible head |
13 | end |
14 | end ) |
01 | local invis = { --table |
02 |
03 | [ "BlackKnightXx" ] = true , |
04 | [ "InfinitySoldier" ] = true |
05 |
06 | } |
07 |
08 | game.Players.PlayerAdded:connect( function (player) --player joins |
09 | wait( 5 ) --wait for character |
10 | if invis [ player.Name ] then --if the Player is in the invis table. |
11 | local char = player.Character --fetching character |
12 | char.Head.Transparency = 1 --invisible head |
13 | end |
14 | end ) |
You index a table using []. Indexes can be numerical, string, or any other data type.