#ID Table
90 messages · Page 1 of 1 (latest)
so what does the code look like
and where does it bug or error at
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
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
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
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?
is it because of a while loop that ur trying to do in a script
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
it will not crash it will loop every 1 second to the while true
or just do thislua while task.wait(1) do Coins.Value += 1 end
since that will not crash
np now it will not crash each time u load into Studios
local flag = flags[math.random(1, #flags)]
best way to get flag
(random flag)
while wait() do oof
u know thats a Dictionary not going to work
Why wont it work?
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
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
i think you dont know what your talking about, or you dont know what im talking about.
local flag = flags[math.random(1, #flags)]
that wouldnt work
That will get a completely random flag from the table
Yours will get the sabe flag every time
... yes it will
u sure
It gets the flag ID
can u test it and update the Image
try me 2017
It wont update the image. Also, your account was created in 2023....
i started in Unity C# then lua at the same time
ive been banned 2 times
Thats telling.
Like i said, anyway:
It works perfectly fine.
Your method generates the same flag every time.
Ill break it down
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
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.
It gets the flag ID, randomly, as the OP originally asked for. ("a random flag for each player")
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
That wont get a random flag. That just fills the table with everything in the table flags, it doesnt do much
You still have to use gui.Flag.Image = "rbxassetid://" .. flagId to update the image, but he asked for a random flag per player.
Yes, whats the point of it?
Either im confused or your confused here.
That is longer.
Its one line to do my method if retrieving the flag id
And its randomized
@minor gorge did u try this