I legit watched so many lua tutorials and I even have a book on how to script lua and then I’m like: Oh my god I’m so good! 2 days later the only thing I know how to do is to print stuff.
How to use: table.remove(table, the element u want to remove from the specified table) Used to remove stuff from an inventory for example table.sort(table) Rearrange a table, this may work if u make a puzzle game and would like to recreate the area or make the puzzle solve for itself table.concat(table, ", ") A way of printing the contents of the table, this may be useful if u have a list somewhere that a player has to completes
@@Tentrin_boom Well Lua tries to be easier to use than python but after using Roblox for a few weeks I realized that Roblox throws that simplicity out of the window, imo at least.
I swear, the views of the videos are getting lower and lower. I feel like players are giving up, but whoever made it this far. Good job kiddo, you will make it as a advanced scripter.
I may be too late to say, but DAMN it feels good when he makes a mistake in code and you can detect it before he does. This is Such an awesome series, tysm!
TheDevKing I have always found watching torturials boring and just not fun but watching yours has got me inspired to keep trying and it’s also fun to watch Bc you explaining and making it simple to understand
Just a side not for those of you wondering. I think TheDevKing didn't mention *table.foreach()* and *table.foreachi()* for a good and specific reason. The functions *table.foreach()* and *table.foreachi()* (in Lua 5.1) are *deprecated* - meaning that these functions *should not* be used in ‘new code’ because they are in the process of being replaced and no longer existing. Using these functions *might* still work; however, they will soon no longer be in use. Instead of using these functions, you should use *pairs or ipairs loops* - which he has a video on.
Ok, I think someone has to put this out, TheDevKing is the best Scripting Teacher! He is funny and not dry unlike other devs, he is slow and explains everything deeply, he doesn't clickbait and makes short videos. Thank you for helping us learn how to script!
I'm glad there are some connections from scratch I can make in Lua. I can connect tables to lists, and I know how to use lists. They are useful for things like potion making, cooking as he said, and inventories. They can also be used for things like server leaderboards I believe.
@@ultrawoozie ive quit learnig 3 times im dedicated now its hard to focus cuz adhd but i am doing it and i see great progress, ive scripted big scripts im sure after all advanced tutorial ill be a decent scripter but that doesnt stop there i have to learn more to earn experience
i cool thing you might now is if you want to make the outcome random you can do print(tablename[math.random(1, amount of stuff in your table)]) it it will print random
Aidan Ko Oh cool, I’m trying to force myself to stick to 2 things at a time lol. I don’t wanna get into the habit of trying to learn 50 things at once... Anyways, I’m learning roblox Lua and SQL Server database technology right now, and plan to move to Unreal Engine and C/C++ after my friend and I release our roblox game (will still provide updates).
lol when he starts talkin about omlette i remember armstrong from MGRR sayin "Making a mother of all omlettes here Jack, Can't fret over every egg!" and its funny ngl
00:02 Tables in Roblox scripting allow for storing multiple values 01:34 Tables can store various types of values, including numbers, strings, and object locations. 03:11 Adding and accessing table elements in Roblox Lua 04:42 Learning about table functions in Roblox scripting 06:08 Tables in Lua can be sorted in alphabetical order or least to greatest. 07:48 Using tables and concatenate in scripting 09:27 Using table.concat to merge values into a single string 10:58 The next tutorial will cover tables and it will be the last of the beginner series. Crafted by Merlin AI.
Thanks, after 3 minutes of watching, I made a script print a random thing inside my table! The code is here: local p = 214 local myfirstTable = {13, "yes", true, 6.66, p} print(myfirstTable[math.random(1,5)])
@@bloxplaysyt3602 it IS useful, you can use it to make a random number generator. Extremely useful for random events happening in your game (example, tower battles choosing random maps for voting or tds elevators choosing random maps)
I wanted to learn how to code in roblox when I was 5 but I never found a good tutorial to learn it. After years and years finally I found TheDevKing.And I gotta say I recommend this channel for all those who wanna learn just like me. Also, tnx TheDevKing
@@thurapy684 LOL yea I was interested in coding since I was like 7 and playing pvz, now I'm 14 and just started learning about 3 months ago, I've moved on from java and am now here, started on roblox lua yesterday.
btw you can put a table into a var so that you can print it like this: local PlayersPhoneNumbers = {4, 6, 2, 3, 8} local x = table.concat(PlayersPhoneNumbers, "") print(x)
I’m just wondering when you do Let’s say for example local FavoriteLetters = (“B”, “A”) table.sort(FavoriteLetters(1)) print(FavoriteLetters(1)) Would it print B or A? Theoretically it would print B but if you sort it, would it sort strings in alphabetical order?
So in a table can you do this?: local BaseplateTable = {game.Workspace.Baseplate.Transparency = 0.5 game.Workspace.Baseplate.Reflectance = 1 game.Workspace.Baseplate.BrickColor = BrickColor.new("Baby Blue")} if BaseplateTable.Transparency = 0.5 then destroy end
Hmm so is this how you would do crafting? like: local craftingMaterials = {"Ham", "Egg" , "Cheese"} --then would this work? if(table.concat(craftingMaterials, ", ") == "Ham, Egg, Cheese") instance.new("Omelette", game.workspace)
I watched all of your tutorials and thats was awesome and very clearly, luckily I know python, c++, java, c# and etc' so I can understand that very well
I just made my first ever cannon but the problem is, I don’t know how to make a delay so u can’t spam it lol and if I should put :Destroy() inside the clicked event or outside of it
spot6003 thank you for replying! I was able to fix it yesterday and also so created a teleport pad :D and a button that changes leaderstats into either pirate with bounty or Marine with respect XD it’s cheesy xD
InsertTableHere = {} game.Players.PlayerRemoving:Connect(function(player) table.remove(InsertTableHere, player) end) If you want to add HowManyPlayers = {} game.Players.PlayerAdded:Connect(function(player) table.insert(HowManyPlayers, player) print(#HowManyPlayers) -- The hastag is referring how much things are in that table end)
@@Gadavious101 Thanks for helping out! I had struggled to find the solution but I guess it was the hashtag. I will just analyze this reply and learn it myself
yeah tables inside a table are normally called 2D tables. For example you can make a num pad like so: local Table2D = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {"#", 0, "*"}, } And then you can call the values like so : print(Table2D[2][3]) and that would give you "6"
im really new, i made this thing. did i do it right? local mytable = {game.Workspace.Part, 6, 3, 7, 2} mytable[1.].Position = Vector3.new(0, 0, 0) if mytable[1].Position == Vector3.new(0, 0, 0) then print("ok") end
Hey guys! Be sure to join the discord server if you have any questions or if you would like to meet me! discord.gg/FKcSyRh
Devking I found out that when your doing the table concat you dont need to add the punctuation marks if you want to have them in a string seperated.
I legit watched so many lua tutorials and I even have a book on how to script lua and then I’m like: Oh my god I’m so good! 2 days later the only thing I know how to do is to print stuff.
Apparently the discord link expired
@@UsernameDP discord.gg/rodevs
When I watch this feels like back when I was python class.
He’s sounds super happy.
No u
Yea right!
No u
TO END THIS BORING BEGINNER SERIES!
@@jealousjoy yeah it’s supposed to be boring but u definitely learn something
I swear that when he said about the cooking game, I thought he was going to put in hotdogs.
or hamburgers.
hamborgr
me too
thats not a bad thing and the likes you have are... 😳😳😳😳😳😳
you can even feel the hotdog coming inside you
How to use:
table.remove(table, the element u want to remove from the specified table) Used to remove stuff from an inventory for example
table.sort(table) Rearrange a table, this may work if u make a puzzle game and would like to recreate the area or make the puzzle solve for itself
table.concat(table, ", ") A way of printing the contents of the table, this may be useful if u have a list somewhere that a player has to completes
we watched the video.
@@desirewarare you sped?
He is speed.
@@okran930 yes, he's definitly speed
Him: "Lua Roblox starts at 1"
Me: "What sorcery is DIZ?"
I know right, that should be illegal.
@@Tentrin_boom Well Lua tries to be easier to use than python but after using Roblox for a few weeks I realized that Roblox throws that simplicity out of the window, imo at least.
@@Tentrin_boom ur so lucky no one whoooshed you
r/whooosh
@@warjt4737 lol
I swear, the views of the videos are getting lower and lower. I feel like players are giving up, but whoever made it this far. Good job kiddo, you will make it as a advanced scripter.
To all the people who made it this far good job! Now keep going!😊
thanks my dream is to make games and help peoples to make better games
@@ironkiller6504 np bro what do you wanna do, code or build or design?
@@ironkiller6504 or something else
@@stuntfax9004 coding
@@ironkiller6504 niceeeeeeeee what tutorial are you up to
I may be too late to say, but DAMN it feels good when he makes a mistake in code and you can detect it before he does. This is Such an awesome series, tysm!
i could not agree more 😂
@@expedito5222 definition of mistake
@@cha0ticClipzzWhy be mean?
TheDevKing I have always found watching torturials boring and just not fun but watching yours has got me inspired to keep trying and it’s also fun to watch Bc you explaining and making it simple to understand
thank you all other scripting series I tried either discontinued or make things too complicated, but you make it so easy! thank you!
Just a side not for those of you wondering. I think TheDevKing didn't mention *table.foreach()* and *table.foreachi()* for a good and specific reason.
The functions *table.foreach()* and *table.foreachi()* (in Lua 5.1) are *deprecated* - meaning that these functions *should not* be used in ‘new code’ because they are in the process of being replaced and no longer existing. Using these functions *might* still work; however, they will soon no longer be in use. Instead of using these functions, you should use *pairs or ipairs loops* - which he has a video on.
oh ok thx for info
sounds like a new apple product
@@poopygamer321 apple doesn't run lua
@@QUBIQUBED f
makes sense though because apple was never good for anything besides doing work at 3 fps
@@poopygamer321 No it's because apple doesn't give a shit about Lua not because "it can't handle it" it's a coding language dumbass
Ok, I think someone has to put this out, TheDevKing is the best Scripting Teacher! He is funny and not dry unlike other devs, he is slow and explains everything deeply, he doesn't clickbait and makes short videos. Thank you for helping us learn how to script!
truerer words have never been spoken
and hes addicted to hotdogs
@@GobsmackedIHATENI Facts
his videos are shorter than other tuts but ive learned a lot more by watching him then them
@@yaboylante5106 hello watch my tuts
The best person for roblox tutorials!
im gonna continue tomorrow i've watched every video but the first one in this series (and also the 19th) can't wait for the advanced
Same!
same dude
Please make a tutorial for. For loops and for ipairs and pairs. Thanks
I actually did! it's the next tutorial coming out :D
you guys ever realize that he loses views every video?
that means that a few people get to know scripting fully
people slowly give up
@@ChineseCommunistParty. yep kinda sad ngl
@@ZiggySupplied ethernet is better than wifi yes
@@ChineseCommunistParty. yes
@Nomaan raja wdym idiots how is it idiotic to lose motivation lol
TO EVERYONE WHOS TABLE IS SAYING "Workspace failed to load". Instead of print(number(1)). say print(number[1])
THANK YOU!
I DID THIS TYSM
I'm glad there are some connections from scratch I can make in Lua. I can connect tables to lists, and I know how to use lists. They are useful for things like potion making, cooking as he said, and inventories. They can also be used for things like server leaderboards I believe.
amen
@@soupp bro wtf ????????????????????????
you're a scratcher too??
Tables is a variable with more than 1 data in it.
It's basically like a list in python
It's like an array
It's like ur mom
Sorry I had to
@@possiblyrandom6703 Lmao worth the joke
3:55 suprised you didn't say hotdog...
HEeh
I mean if you know... you know.
you mentally replace it with hotdog, and yes, hodog is now made of ham, egg, and cheese
@@TblSlt yeah hodog
I've been watching the whole series, and I'm no giving up! DEDICATION!!!
hey quick update where are you now 8 months later, have you stuck to the words you said or no?
@@ultrawoozie ive quit learnig 3 times im dedicated now its hard to focus cuz adhd but i am doing it and i see great progress, ive scripted big scripts im sure after all advanced tutorial ill be a decent scripter but that doesnt stop there i have to learn more to earn experience
@@deivanna how you going now
@@deivanna so how are you doing?
If you table.sort with strings, it does them by alphabetical order.
i cool thing you might now is if you want to make the outcome random you can do
print(tablename[math.random(1, amount of stuff in your table)])
it it will print random
ik im in 2020 but really you explain better then anyone!
iv been looking for someone like you on youtube forever!
(i sub)
ik im in 2022 but really you explain better then anyone!
iv been looking for someone like you on youtube forever!
(i sub)
@@Layththelion21 ik im in 2023 but really you explain better then anyone!
iv been looking for someone like you on youtube forever!
(i sub)
@@The_SUR ik im in 2024 but really you explain better then anyone!
iv been looking for someone like you on youtube forever!
(i sub)
@@Layththelion21 Hello random people
HELLO I AM IN NEED OF SCRIPTING ATTENTION
(what am I saying)
At this rate, I'm mixed up with Python, Lua and C++/C#
Ahh... the world of programming, isn’t it just wonderful how many technology choices it gives you... MY BRAIIIN
same, then you have unity which is just weird in itself
I'm doing further Css, Python, Javascript and Lua rn
Aidan Ko
Oh cool, I’m trying to force myself to stick to 2 things at a time lol. I don’t wanna get into the habit of trying to learn 50 things at once...
Anyways, I’m learning roblox Lua and SQL Server database technology right now, and plan to move to Unreal Engine and C/C++ after my friend and I release our roblox game (will still provide updates).
@@MJTFreeTime can i play
You deserve 10000 subscribers!
Thanks :D
He achieved it now, doubled.
205k ._.
Wow, I learned so much on this series :D
to make things simpler a table is similar to an array which means a variable which has different slots for you to store values
*How many times does he say okay in his video?*
*👇*
more than 6
@@chrismelon8192more than 7
This tutorial is on the tip of my tounge, thank you so much for the tutorials!
The best scripting teacher ive encountered on youtube and thats facts
on the grind watching ur vids
(tysm)(subbed, liked etc)
lol when he starts talkin about omlette i remember armstrong from MGRR sayin "Making a mother of all omlettes here Jack, Can't fret over every egg!" and its funny ngl
omg im nearly done for the advanced tutorial!!!
wow devking
this was your chance to bring up you're famous hotdog reference but you didnt
im disappointed in you man :(
I just looove your vibeee!!!!
9:21
You could also use *print(unpack(PlayersPhoneNumbers))*
Me: as soon as he puts in the ingredients for the omeletes
My head: Egg, ham and cheese!!!!!
i know im 4 years late, but gotta say out of all the tutorials that explained tables you explained tables efficiently
Thank you so much. I was extremely confused on how to do something, and u helped a lot
00:02 Tables in Roblox scripting allow for storing multiple values
01:34 Tables can store various types of values, including numbers, strings, and object locations.
03:11 Adding and accessing table elements in Roblox Lua
04:42 Learning about table functions in Roblox scripting
06:08 Tables in Lua can be sorted in alphabetical order or least to greatest.
07:48 Using tables and concatenate in scripting
09:27 Using table.concat to merge values into a single string
10:58 The next tutorial will cover tables and it will be the last of the beginner series.
Crafted by Merlin AI.
Thanks, after 3 minutes of watching, I made a script print a random thing inside my table! The code is here:
local p = 214
local myfirstTable = {13, "yes", true, 6.66, p}
print(myfirstTable[math.random(1,5)])
lol i was confused with what this means, but now i get it after i tested it
Wow so useful!
@@banananana3515 was that sarcastic? cuz if that was, you are wrong
@@bloxplaysyt3602 😐
@@bloxplaysyt3602 it IS useful, you can use it to make a random number generator. Extremely useful for random events happening in your game (example, tower battles choosing random maps for voting or tds elevators choosing random maps)
THank you for making these videos for us!! I would never could understand any of this without your videos
One more tutorial and we are almost pro's...
That's was a good trip wanst it?...
ThAtS a JoJo ReFeReNcE
its amazing how easy tables are in lua
This is an array if you like since arrays are used for som coding ways
Thanks, I’m making a train game and this is helpful for the passenger screens (e.g I can programme destinstions)
I wanted to learn how to code in roblox when I was 5 but I never found a good tutorial to learn it. After years and years finally I found TheDevKing.And I gotta say I recommend this channel for all those who wanna learn just like me.
Also, tnx TheDevKing
5 ??? bro when i was five i was still eating my own shit and this guy wanted to code wtf
@@thurapy684 LOL yea I was interested in coding since I was like 7 and playing pvz, now I'm 14 and just started learning about 3 months ago, I've moved on from java and am now here, started on roblox lua yesterday.
Did anyone realize his mic quality got better as this series progress
ya because the dog died
He’s good at making this script tutorial videos, I even learned a lot like Tables,Events,Functions and more, Your the best TheDevKing
btw you can put a table into a var so that you can print it like this:
local PlayersPhoneNumbers = {4, 6, 2, 3, 8}
local x = table.concat(PlayersPhoneNumbers, "")
print(x)
Bout to finish this then its, Advanced tut keep up the good work you earned a sub discord member and a possible youtube member.
So this is like an ArrayList but lua version?
Splash yeh that’s what I was gonna ask
Hey TheDevKing, can you please make a video showing how we can make meshes equitable by pressing a button on the guiscreen?
Thank God its an omelet and not a hotdog.
he has evolved, he doesnt use hotdogs as much
this guys is like the best roblox tutorial maker
I watch the tut I learn but forget it in an hour how do I remember do I keep going back to where I need help and practice that?
did anyone else while taking this tutorial felt like that they wont be able to make a game and remember all this stuff?🤔
same ):
@@SubToTheDetectiverOfficial So what we do now 😰😰
@@EtherealRblxPixels well idk im watch another tut
no
8:29 this is because the computer always starts with the number 0 first, and then from 0 it goes on
I’m just wondering when you do
Let’s say for example
local FavoriteLetters = (“B”, “A”)
table.sort(FavoriteLetters(1))
print(FavoriteLetters(1))
Would it print B or A? Theoretically it would print B but if you sort it, would it sort strings in alphabetical order?
yes it sorts strings in alphabetical order
in this case after the script sorts this table it will print A as the 1st value in the table
So in a table can you do this?:
local BaseplateTable = {game.Workspace.Baseplate.Transparency = 0.5
game.Workspace.Baseplate.Reflectance = 1
game.Workspace.Baseplate.BrickColor = BrickColor.new("Baby Blue")}
if BaseplateTable.Transparency = 0.5 then
destroy
end
game.Players.PlayerAdded:Connect(function(player)
local things = {player.Name, 'joined', 'the game'}
print(table.concat(things," "))
end) --lol
@JoKer YT that's the function name so if you want to recall it again you would do local function(player)
Ginger Beer no dude ;-;
JoKer YT that specifies that it is a function, and (player) is the parameter from PlayerAdded, which is the player that was added
Fr3nx no
@@zoop706 Fr3nx is right though.
i have learned tutorial but i just cant understand one thing how can i use them i know there meaning but i dont know how to use these words or numbers
Thanks alot! This helps me make my admin list.
Can someone help me with table.sort the second parameter?
Bro is turning me into a actual dev.
I am RAGED where is your HOTDOG ;)
I radged to
Hotdogs: why did u leave me in the dark😔 lol
TheDevKing I tried to skip to learn table.move can you tell me the part
its best if u watch all the videos
i havent myself cause i watched some of alvinblox's but he didnt finish so im here
now were getting into lists
useless script I made :)
local array = {4,2,4,5,2,1,2,2}
local sum = array[1] + array[2] + array[3] + array[4] + array[5] + array[6] + array[7] + array[8]
print(table.concat(array,"+").." = " .. sum)
Wow your profile scared me.
I like how when you say "okay" the chapter changes (I mean transcription)
it took me 10 minutes to find out i was using the wrong brackets
lol
same Xd 10 min
Hmm so is this how you would do crafting?
like:
local craftingMaterials = {"Ham", "Egg" , "Cheese"}
--then would this work?
if(table.concat(craftingMaterials, ", ") == "Ham, Egg, Cheese")
instance.new("Omelette", game.workspace)
no lol
@@zoop706 lol
not really as concat is only for printing so it would only print omelette
How come you never use wait() in your tutorials
But good tutorial
he does
BRO THANK YOU YOU ARE LITTRY THE BEST FRICKIN TEACHER EVER BRO
1st
You kinda sound like g0z kinda ._. (Btw thank you for the tutorial :>
denis
I watched all of your tutorials and thats was awesome and very clearly, luckily I know python, c++, java, c# and etc' so I can understand that very well
Im sure DevKing is very good at cooking
I just made my first ever cannon but the problem is, I don’t know how to make a delay so u can’t spam it lol and if I should put :Destroy() inside the clicked event or outside of it
Congrats dude. I would add a debounce for that
spot6003 thank you for replying! I was able to fix it yesterday and also so created a teleport pad :D and a button that changes leaderstats into either pirate with bounty or Marine with respect XD it’s cheesy xD
That will outside right?
6:40 time stamp for myself :)
Tables always confused me from Alvin blox’s scripting tutorial
DevKing: This Will Be The Last Of The Beginner Series
Beginner Roblox Scripting #19: Are You Sure About That
sus:
local sus = {"blue", "yellow", "red"}
if table.find(sus, "red") then
print("sus")
end
if it helps tables are basically just lists like from scratch
Now we know that trying to merge omelette ingredients instead of cooking them causes the fabric of reality to collapse, very cool
Can you please make a video about removing a player off a table when they leave?
InsertTableHere = {}
game.Players.PlayerRemoving:Connect(function(player)
table.remove(InsertTableHere, player)
end)
If you want to add
HowManyPlayers = {}
game.Players.PlayerAdded:Connect(function(player)
table.insert(HowManyPlayers, player)
print(#HowManyPlayers) -- The hastag is referring how much things are in that table
end)
@@Gadavious101 Thanks for helping out! I had struggled to find the solution but I guess it was the hashtag. I will just analyze this reply and learn it myself
wait, can you make a table inside a table as well? XD
Edit: Yes. Yes you can!
The possibilities are.. L.I.M.I.T.L.E.S.S.
yeah tables inside a table are normally called 2D tables. For example you can make a num pad like so:
local Table2D = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
{"#", 0, "*"},
}
And then you can call the values like so :
print(Table2D[2][3])
and that would give you "6"
"I dont know everything about scripting [ *insert nervous laugh here* ]"
I love how the views jumped from 4k per tutorial and declining to 160k on this one XD
Could anyone give me an example because i don't really see where you would use tables
Checking if a value is a list of things
2:20 why you always think about food
are there for loops?
when i type the first script it tells me “
assigning 3 values to 1 variables leaves some values unused”
print("The Dev King is the best roblox scripting youtuber")
is there a way to sum all the numbers in a table instead of just doing print ("("..table.concat(numbers, "+")..")") and pasting it into a calculator?
im really new, i made this thing. did i do it right?
local mytable = {game.Workspace.Part, 6, 3, 7, 2}
mytable[1.].Position = Vector3.new(0, 0, 0)
if mytable[1].Position == Vector3.new(0, 0, 0) then
print("ok")
end
you probably already figured this out but yes you did it right,
just remove that dot in line 3 when you are calling the 1st value in the table.
ENORME