sioux123
|
  |
| Joined: 18 Nov 2011 |
| Total Posts: 970 |
|
|
| 29 Jul 2016 04:10 AM |
Have a table of usernames
local list = { "sioux123", "FROZENAURA" }
game.Players.PlayerAdded:connect(function(player) if list[player.Name] then --do stuff end end)
--for some reason idk i have done nothing with tables |
|
|
| Report Abuse |
|
|
nacker
|
  |
| Joined: 06 Oct 2009 |
| Total Posts: 6034 |
|
|
| 29 Jul 2016 04:13 AM |
you need to give your table some values... try this
local list = { ["sioux123"]=true, ]"FROZENAURA"]=true } |
|
|
| Report Abuse |
|
|
sioux123
|
  |
| Joined: 18 Nov 2011 |
| Total Posts: 970 |
|
|
| 29 Jul 2016 04:15 AM |
| if it has no values is it called an array |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2016 05:14 AM |
for index,value in pairs(list) do if value == "FROZENNAURA" then return index, value end end
http://wiki.roblox.com/index.php?title=Function_dump/Basic_functions#pairs http://wiki.roblox.com/index.php?title=Loops#For |
|
|
| Report Abuse |
|
|
|
| 29 Jul 2016 07:14 AM |
local List = { "DurstAuric", "Player1", } function ScanTable(Table, Result) for _, Value in pairs(Table) do if (Value):lower() == (Result):lower() then return true end end end game:GetService("Players").PlayerAdded:connect(function(Player) if ScanTable(List, Player.Name) then print(Player.Name .. " has joined and is in the list.") end end)
( ͡• ◡ ͡•) -=[ RAP: 350,892 || DurstAuric; the narb of ROBLOX ]=- ( ͡• ◡ ͡•) |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 29 Jul 2016 07:34 AM |
--Do you mean this? Array = {'String1', workspace, 'String2', nil, 46453555, 'String3'} for i,v in pairs(Array) do if type(v) == 'string' then print(v) end end |
|
|
| Report Abuse |
|
|
UFAIL2
|
  |
| Joined: 14 Aug 2010 |
| Total Posts: 6905 |
|
|
| 29 Jul 2016 08:21 AM |
| Do what nacker posted most efficient and most compact code. |
|
|
| Report Abuse |
|
|
DevVince
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 9245 |
|
|
| 29 Jul 2016 08:24 AM |
| You shouldn't use Usernames, there's this thing called name changing only one thousand Robux to do so. Use UserId's. |
|
|
| Report Abuse |
|
|