#ID Table

90 messages · Page 1 of 1 (latest)

minor gorge
#

so i was trying to make a id tool, where the tool displays stuff like: account name, account age, avatar image, etc. but i have one problem: im trying to make a flag, so the id card displays a random flag for each player. i have all the id's, but when i tried to make the table it didnt work. feedback and help please?

craggy oyster
#

so what does the code look like

craggy oyster
minor gorge
#

well so far i just have id's of images

#

i just scrapped the table

#

i figured just to restart on it

#

it used to be like

#

hold on lemme check

craggy oyster
#

so return before u removed the Table

#

like make it so i can look over

minor gorge
#

ok

#

here

#

local gui = script.Parent.Handle.GUI
local flags = {"7213809722", "5826570404", "9110900644", "9124778742", "10031882093", "8895036587", "624478595", "198692974", "3149186217", "9630996457", "5574666258", "6035305911", "6579887771"}
script.Parent.Info.OnServerEvent:Connect(function(player,age,id)
gui.Age.Text = "Account Age (Days): " .. age
gui.ID.Text = "ID: " .. id
gui.PlayerName.Text = "Name: " .. player.Name
gui.ProfilePic.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=200&Format=Png&username=" .. player.Name

gui.Flag.Image = "rbxassetid:// .. flags[1]"
#

i have mutiple other scripts, that work fine the only thing that doesnt work is the flag

craggy oyster
#
local gui = script.Parent.Handle.GUI
local flags = {"7213809722", "5826570404", "9110900644", "9124778742", "10031882093", "8895036587", "624478595", "198692974", "3149186217", "9630996457", "5574666258", "6035305911", "6579887771"}

script.Parent.Info.OnServerEvent:Connect(function(player, age, id)
    gui.Age.Text = "Account Age (Days): " .. age
    gui.ID.Text = "ID: " .. id
    gui.PlayerName.Text = "Name: " .. player.Name
    gui.ProfilePic.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=200&Format=Png&username=" .. player.Name

    gui.Flag.Image = "rbxassetid://" .. flags[1]
end)```
#

did it work

minor gorge
#

well idk ive been trying to test it, but my studio freezes when i test it, this started happening last week

#

its been happening in all my games

#

the only thing i can think of why thats happening is the new roblox fonts or smth?

craggy oyster
#

is it because of a while loop that ur trying to do in a script

minor gorge
#

maybe..

#

has it been a popular bug?

craggy oyster
#

it never happens to me if i forget a ```lua
while true do
Coins.Value += 1
end

#

that will crash kinda
but now lua while true do Coins.Value += 1 task.wait(1) end

minor gorge
#

ohh

#

well ill try that

craggy oyster
#

it will not crash it will loop every 1 second to the while true

minor gorge
#

oh ok thanks.

#

idk how i forgot

craggy oyster
#

or just do thislua while task.wait(1) do Coins.Value += 1 end

#

since that will not crash

minor gorge
#

ok

#

thanks ill do that like a 100 times

#

i got so many

craggy oyster
#

np now it will not crash each time u load into Studios

grim walrus
#

(random flag)

craggy oyster
grim walrus
#

Aslong as the table "flags" is defined, it will.

#

Hes using a table with a list of IDs

#

that will generate a random flag out of the table

#

Its not a dictionary its literally 1 line

#

its actually pretty simple code

craggy oyster
#
local gui = script.Parent.Handle.GUI
local flags = {7213809722, 5826570404, 9110900644, 9124778742, 10031882093, 8895036587, 624478595, 198692974, 3149186217, 9630996457, 5574666257, 6035305911, 6579887771}

script.Parent.Info.OnServerEvent:Connect(function(player, age, id)
    gui.Age.Text = "Account Age (Days): " .. age
    gui.ID.Text = "ID: " .. id
    gui.PlayerName.Text = "Name: " .. player.Name
    gui.ProfilePic.Image = "http://www.roblox.com/Thumbs/Avatar.ashx?x=150&y=200&Format=Png&username=" .. player.Name

    local flagId = 0
    for i, v in pairs(flags) do
        if v == id then
            flagId = v
            break
        end
    end

    if flagId == 0 then
        flagId = flags[1]
    end

    gui.Flag.Image = "rbxassetid://" .. flagId
end)```
#

all better since now its not a Dictionary

grim walrus
#

i think you dont know what your talking about, or you dont know what im talking about.

#
local flag = flags[math.random(1, #flags)]
craggy oyster
#

that wouldnt work

grim walrus
#

That will get a completely random flag from the table

#

Yours will get the sabe flag every time

grim walrus
craggy oyster
#

u sure

grim walrus
#

It gets the flag ID

craggy oyster
#

can u test it and update the Image

grim walrus
#

Im a scripter going on 4 years now.

#

Since 2019.

craggy oyster
grim walrus
craggy oyster
#

i started in Unity C# then lua at the same time

grim walrus
#

Alright

#

Anyway,

craggy oyster
grim walrus
#

Like i said, anyway:

#

It works perfectly fine.

#

Your method generates the same flag every time.

#

Ill break it down

craggy oyster
#

the first account was made in 2016
and the second is made in 2019
and this one this year

#

trust me i know what im doing

grim walrus
#
local flag = flags[] -- this gets a value from that position in the table
#
math.random(1, ?) -- this generates a random number between 1 and ?
#
#flags -- this is the number of arguments in the table
#

It works fine.

grim walrus
craggy oyster
#

why not do a table likelua local Table = {} for i = 1,#flag do table.insert(Table,flag[i]) end for i,v in pairs(Table) do print(v) end

grim walrus
craggy oyster
#

it prints the id

#

and dolua table.sort(Table[v])

grim walrus
grim walrus
#

Either im confused or your confused here.

grim walrus
#

Its one line to do my method if retrieving the flag id

#

And its randomized

minor gorge
#

yes

#

it works, tysm