01 | local players = game:GetService( "Players" ) |
02 | local gui = game.ServerStorage.Name_stats |
03 | local creatorsgui = game.ServerStorage.Creators |
04 |
05 | local function createGui(player, character) |
06 | local gc = gui:clone() |
07 | local cgc = creatorsgui:clone() |
08 | local name = player.Name |
09 | local level = player.leaderstats.Level |
10 | local cnames = { "duckyo01" , "tonymayhem" , "Bluefeather2011" , "Bladedevv" , "Verassi" , "Sourskittles" } |
11 | while character do |
12 | wait() |
13 | if name = = cnames then |
14 | cgc.Parent = character.Head |
15 | cgc.Nameandlevel.Text = "Creator | " ..name.. "" |
Yes my main account name is duckyo01 so me typing my name wrong is not a reason.
There are several things you can do to fix this script. One thing you can do is implement your names as a set
. With a set, you can simply index the names to check if it is in the set, like so:
01 | -- Convert your table into a set. You can probably write a function that does this for you... |
02 | local cnames = { |
03 | duckyo 01 = true , |
04 | tonymayhem = true , |
05 | Bluefeather 2011 = true , |
06 | Bladedevv = true , |
07 | Verassi = true , |
08 | Sourskittles = true |
09 | } |
10 |
11 | ... |
12 |
13 | if cnames [ name ] then -- will be true or nil, depending on whether or not it is in the set |
14 | ... |
You can also try iterating through the list of names. Although this is slower if you're working with a large list of names (probably not enough to actually matter, though.)
01 | local cnames = { "duckyo01" , "tonymayhem" , "Bluefeather2011" , "Bladedevv" , "Verassi" , "Sourskittles" } |
02 |
03 | ... |
04 |
05 | local nameFound = false |
06 | for _, cname in pairs (cnames) do -- check each name in cnames |
07 | if cname = = name then -- if we find the name we were looking for |
08 | nameFound = true -- then set nameFound to true |
09 | break |
10 | end |
11 | end |
12 |
13 | if nameFound then -- did we find the name that we were looking for? |
14 | ... |