#I don't understand this
1 messages · Page 1 of 1 (latest)
Functionally understanding how this works requires you to know much more than you do now; you're getting ahead of yourself
You understand that you can pass values to functions. This is formally categorized under "arguments & parameters", where the values you pass are dubbed "arguments". Functions in Luau are first-class, meaning they're treated like any other datatype. This means functions can be passed as arguments like any other value
I was watching that YouTuber's playlist, so I thought that was the next thing I needed to understand.
You're passing a function literal to RBXScriptSignal:Connect, a higher-order function which accepts a single function as an argument
That function gets store in the event object, and when Roblox's engine encounters the code that should trigger the event, it executes the stored functions within the event with relevant arguments
Each function is executed asynchronously
He said he just stared man i don't think he understands this... I barely do...
^
These tutorials don't teach you anything, lol
Basically, Roblox calls the function for you, and provides it with the Player instance upon that call. This is how the parameter gets its value
No differently from how you would call the function yourself
i think i understand a lil bit but i mean, idk how to learn propely beacuse the videos dont explain that
Thats not what i mean
Let me give you a better roadmap
alr
while technically correct there's no way a beginner is going to understand any of what you just said
Variables
Datatypes
Arithmetic operators
If statements
Relational operators
Logical operators
Boolean logic
Scope
Loops
Functions
Arguments & parameters
Higher-order functions & callbacks
Tables
String library, miscellaneous operators
Task & coroutine library
Events (RBXScriptSignal, RBXScriptConnection)
Client-Server model
Algorithms and data structures
This is what i mean to say
the player's name appears because that's just simply how a player object looks when you print(player). what else should it print, object0x000000? roblox is nice like that 🙂
No other way to put it. Explaining it would be no different from teaching it from scratch
Doing that effectively would take ~20-30 minutes via video call
I've had this discussion before, lol
Prints the same if u do player.Name right?
try print({})
Yes
;compile lua lua print({})
table: 0x6391504acd40
that's what it actually is, but roblox is convenient, it knows what the player object is and prints its name instead of that.
print invokes the __tostring metamethod. Instances implement it to return the instance's name
is when the function runs without stoping the execution of the other part of code or something like that?
Ty
in simple terms, yes all other code "stops execution" until the code that is running either finishes, returns, or yields
it's just the fact that roblox has a bunch of conveniences, and because code runs extremely fast, you don't really notice
async is not 2 scripts running at the same time. that'd be parallel lua. async has more to do with the task scheduler/ timer thing
is only for large codes we can notice i suppose
This model is known as "cooperative multitasking"
And how do you recommend I learn? By watching videos? By reading the Roblox wiki?
It is what Roblox provides through its coroutine and task libraries
Forget videos
Read
alr
Ask questions here
read docs, watch videos, google stuff, and most important of all, practice.
If anything, use YouTube for reference material—a means to start searching for articles on things
learn a new programming word every day and you'll reach our level in what, say a year tops? there's lots of words to learn, no different from any other skill.
Terminology is very important
Ok ty guys Ur so nice ♥️
Documentation and articles are some of the most powerful resources out there. They're technical as a byproduct, so knowing how to interpret them is key
It also goes a long way in understanding what you're doing and what you're writing
Alr
And with research, too
I didnt understand a part of this code on roblox wiki
local fruitName = "Chocolate"
local fruitTable = {
Lemon = "Yellow",
Apple = "Red",
Orange = "Orange"
}
local function getFruitByColor(color)
local fruitName
for key, value in fruitTable do
if value == color then
fruitName = key
end
end
return fruitName
end
local fruit = getFruitByColor("Yellow")
print(fruit) -- Lemon
print(fruit .. ", not " .. fruitName) -- Lemon, not Chocolate
on the for boucle
** You are now Level 5! **
what is key and value
@remote thunder (sry if i bother u, tell me if u dont wanna be ping)
look at fruit table
also play with the code
you're not expected to understand it right away immediately, no one does. so play with it and find out how it works.
if i just tell you, you wont learn anything.
Lemon is a Key
and
Yellow a value
so
for each key in the table and their values,
we verify if the value is a color. Then the variable fruitName is also a key, so we return "chocolate".
Then we print the local fruit (which has the value from the function that searches for a yellow fruit). That's why the first result is "Lemon", and the following print concatenates the same result as before with fruitName, which is equivalent to "chocolate".
I think I just understood.
why are you guessing? you have the code in front of you. mess with it and find out?
use what you learned and make something new with it?
maybe do other things with it too?
like make a vegetable table?
count how many fruits there are?
make then build on it and give each fruit a value or something
like, you dont pay me enough to be your teacher and i'm sure you can come up with your own homework to assign yourself
that's how you learn.
the only reason i dont need to do any of that is because i've already done all that.
alr my bad sry
what i'm trying to show you is called self-directed learning and is one of the most, if not the most important skill you could ever possibly learn
Autodidacticism (also autodidactism) or self-education (also self-learning, self-study and self-teaching) is the practice of education without the guidance of schoolmasters (i.e., teachers, professors, institutions).
if you're able to teach yourself with nothing but online resources, documentation etc, then you have infinite capacity to learn without the need for waiting for anyone, paying people to teach you etc
not to mention, when you ever reach a high enough skill level in any field, you literally won't have a choice since there won't be anyone who is able to teach you anything you don't already know, so you have no choice but to progress further on your own.
it's tough, but there's no limits to what you can learn or how good you can get if you understand and apply this principle
i will do my better
Quick question: let's say I want to do something but I don't know what tools to use to make it. Ex: I want to be a simple dash but I don't know i need to use velocity and stuff to do it, am i supposed to just look at documentation until i find velocity and then realize i can use it for the dash?
no, start with google. tutorials are good for giving you initial direction. you then take all the concepts and put together your own while looking everything up in the docs to see what they do if you don't already know what it does. that way, even if you copy+paste wrong, you aren't relying on the tutorial for free working code, you're only relying on it for basic concepts, ideas, approach, and searchable keywords you can further research.
ai goes a lot the same way, it will give you concepts and ideas, theoretical approaches, and searchable keywords. using ai only becomes a problem when you expect it to produce functional code instead of taking its approach and searching all of its keywords.
Very useful advice thank you
back in the day, yeah you would have to look at documentation until you find velocity and realize you can use it for a dash. fortunately, this is 2025 and we have the luxury of search engines and ai (which is basically just a glorified search engine in many ways) and don't have to resort to such archaic techniques of self learning ;p
imagine that, only 30 years ago you needed a phone book to look up contact info for businesses and people. an actual physical book.
with actually 1000's of pages.
if you wanted to look up anything on "wikipedia", those were called encyclopedias.