So, I'm trying to make a script that when a player joins that is on the "whitelist" (called specials) a chat message shows up. --Shouldn't be too hard to explain @CailThePuppy
PROBLEM Nothing happens, nor does the things print
01 | local specials = { "rexbit" , "TheHospitalDev" , "Player" , "Player1" } |
02 |
03 | game.Players.PlayerAdded:connect( function (player) |
04 | print ( "Hola1" ) |
05 | for x = 1 , #specials do |
06 | print ( "Hola2" ) |
07 | if specials [ x ] = = player.Name then |
08 | print ( "Hola3" ) |
09 | game:GetService( "StarterGui" ):SetCore( "ChatMakeSystemMessage" , { |
10 | Text = "A special player has entered the game!" ; |
11 | Color = Color 3. new( 34 / 255 , 255 / 255 , 0 / 255 ); |
12 | Font = Enum.Font.SourceSansBold; |
13 | FontSize = Enum.FontSize.Size 18 ; |
14 | } ) |
15 | end |
16 | end |
17 | end ) |
That's quite an abstract way of checking a table but there's a lot simpler of a way using a for loop.
1 | local specials = { "rexbit" , "TheHospitalDev" , "etc" } |
2 |
3 | game.Players.PlayerAdded:connect( function (player) |
4 | for x = 1 , #specials do |
5 | if specials [ x ] = = player.Name then |
6 | --code to run |
7 | end |
8 | end |
9 | end ) |
Otherwise I'm not sure what you're asking.