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

What is wrong with this script?

Asked by 11 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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:

01local invis = { --table
02 
03["BlackKnightXx"] = true,
04["InfinitySoldier"] = true
05 
06}
07 
08game.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
14end)

1 answer

Log in to vote
2
Answered by 11 years ago
01local invis = { --table
02 
03["BlackKnightXx"] = true,
04["InfinitySoldier"] = true
05 
06}
07 
08game.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
14end)

You index a table using []. Indexes can be numerical, string, or any other data type.

0
Thanks :D keitheroni 45 — 11y
Ad

Answer this question