Is there a way I could automate this count? Or just put in a list of names in an order and it counts the names in the order?
1 Like
You can just create table like this
table = {Zero,Blue,Charlie}
And when you need a number 34 for example:
table[34]
2 Likes
Use an array:
local names = {"Zero", "Blue", "Charlie"}
local index = 2 --the index is also the number
local name = names[index]
print(name, index)
2 Likes
Just change names in table and values in loop how you want
local something = {
{"One", ""},
{"Two", ""}
}
for cout = 34, 35, 1 do
something[2] = cout
print(something[2])
end
2 Likes
I forgot to mention it throws the numbers in here, how would I change this?
function PopulateCharacterPosList(char_model)
local un_proc = {}
local unavail = {}
local max_def = 0
for _, v in pairs(char_model:GetChildren()) do
local name = v.Name
--if listassign[name] ~= nil then
-- listpositiondata[name] = listassign[name]
-- max_def = math.max(max_def, listassign[name])
--else
local unlock_req = v:FindFirstChild("UnlockRequirements")
local char_avail = v:FindFirstChild("Available")
if unlock_req ~= nil and char_avail ~= nil then
if char_avail.Value then
local char_req = unlock_req:FindFirstChild("Characters")
if char_req ~= nil then
un_proc[name] = {}
for _, e in pairs(char_req:GetChildren()) do
un_proc[name][e.Name] = true
end
end
else
unavail[name] = true
end
end
end
1 Like
I think this adds on as well
PopulateCharacterPosList(replicatedstorage.GameContent:WaitForChild("Characters"))
function getunnum(char)
local v=replicatedstorage.GameContent:WaitForChild("Characters"):FindFirstChild(char)
local char_availabe = v.Available.Value
local Usable = v.Usable.Value
local char_xp, char_bought, char_code_entered, char_unlockeed = FetchCharInfo(char)
local canunlock = MeetsUnlockRequirements(v.Name, char_code_entered) or char_unlockeed
local char_owned = OwnsCharacter(char)
if char_owned then
return 1
elseif not char_availabe then
return 5
elseif canunlock then
return 2
elseif not canunlock then
return 3
end
end
1 Like