I need a understanding of this line of code

Alright here is one line of code that I don’t understand why can there just be a random argument right there and just some random string and what does this do/mean here it is:

remote.OnserverEvent:Connect(player, randomargument)
if "idk123" == randomargument then 

It means that if the string “idk123” equals to “randomargument” then code under it will execute. This works because ‘randomargument’ here is the argument that is delivered by the client firing the event with an argument attached to it. It doesn’t matter how you name it on the server side. It doesn’t detect it by name but by its placement.

So I saw some people doing this in their code but why do this? I dont see a point in doing it, its like adding useless extra code

Doing what, exactly? Naming it like this and not naming it the way you think is appropriate?

Why would it be useless?
Unless you provide more information, then we can see if it’s “useless”.

I was saying, whats the point of an argument and a string, im not talking about what someone was doing specificly

To check if the argument is the same as the string. It can be done if you for instance have a single remote event you send multiple arguments with and you need to know what kind of argument was sent. That’s why you check what argument it is.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.