Is it weird that I don't use remote functions often?

Well, it revolves around what you’re doing. If you’re just changing info on the other end, then RemoteFunctions aren’t needed

One example I can think of is my admin system. I keep certain information stored on the server for security reasons, but of course, admin clients are going to need to access that information to work and display things. So, I set up a RemoteFunction that checks if the client requesting info is an admin, then I return the info to the client, otherwise, I just return nil.

This allows the client to access the info without bad actors also having access to it since their clients will never see it

I didn’t really respond to the original topic. It’s not weird because you can effectively get the same effect by firing the other context (server / client) on the same event.

Not necessarily, if you need to pass through tables, or values you only want the server to create and edit then you would want to use RemoteFunctions, not everything can be done by a RemoteEvent, a lot can be, but if you need to yield for the server to complete you’d need to use that.

It’s actually quite concerning that you’re not really using RemoteFunctions, because there are plenty of things on the server that it’s source shouldn’t be replicated on the client, but the client may need access to a copy. By you’re I’m just speaking to anyone who doesn’t see why to use remote functions

THOUGH, DO NOT USE REMOTE FUNCTIONS IF YOU DON’T NEED TO that’s just bad practice, but RemoteFunctions provide substantial use.

2 Likes

Unrelated but I have been struggling to understand the terms “synchrous” and “asynchrous”. Are these the correct definitions?

Synchrous: Code runs in order (serial), meaning it runs after the line above it.

Asynchrous: Does not have to run in order, and can run whenever you want it to. (e.g. coroutines/task.spawn)

I assume programmers for lua also have a fancy term for running code at the same time? What’s it called? I know this is done in parallel luau.

Thank you for the help, it’s been a question on my mind for a long time.

Synchronous - (It’s chron, meaning time), means that the code will run in order yes, serial. Line by line.

Asynchronous - Means not running at the same time/synchronization, essentially it’s a separate process that doesn’t run in synchronization with the rest of the script.

I hope not because ive never used a remote function in my life

Concerning, here’s an example I have in place for my game.

My game has a management panel where users can rank others in a group, and manage other aspects of the game.

The UI is obviously managed by the client, however permissions should and must be handled on the server for security, and obviously you don’t want the client to have the source table that the server uses, so you’d use a RemoteEvent to invoke the server to send a copy of the permissions.

Then you can check permissions on the client, and then whenever you actually have the action go through, the server will check the permissions. (They should match up, if they don’t you can kick the client for editing the values.)

1 Like

Yeah hearing all this news about using it alot from people is starting to scare me.

Synchronous just means in the same thread and asynchronous will run in a separate thread and usually won’t yield. Parallel is usually having multiple async threads in charge of doing some repeated actions at the same time. With parallel, you might have to deal with race conditions but async usually you don’t.

So was my own meaning of asynchrous correct or no?

Parallel isn’t a LuaU specific term, it’s just general vocabulary I’d say, parallel means literally side by side (it’s running side by side).

Yes, though limited in meaning.

That’s right, but roblox implemented Actors to use parallel luau which makes it very confusing and hard to get into.

So let’s say I create a coroutine and use it, I’m executing the code on a different thread asynchrously right?

1 Like

Parallel LuaU is roblox’s way of implementing multi-threading in a more optimized way for how LuaU functions. It simply adds more complexity, though allows for more synchronization and more performant and efficient asynchronous code.

Using tasks, coroutines and asynchronous functions are still parallel luau by definition. And they do the same thing, just in different ways with more or less optimization.

1 Like

Yep! Coroutines and tasks, are running on a separate thread (A thread is a sub section of a CPU core, which are controlled by processes).

1 Like

I do use them but only for things the client cant access. For example i have a button which gets all the players cash. And cash is only managed and created on the server. So i simply use them for only that.

< Also i use them for things like combat when the hitbox is handled on the client. But i use custom remote functions since if the client yields the thread the server will be waiting for a response and that could cause a memory leak.

1 Like

For real, i use remote events consistently but remote functions, i probably gotta start using those