[PLUGIN] OnServerEvent can only be used on the server

Hello, im trying to make a plugin. Im using events at some point. When I save the plugin it gives “OnServerEvent can only be used on the server” error. Im already using server script. Couple days ago it was working now, it doesn’t. Am i missing something, like i can’t use events at plugins?

rsErr

2 Likes

Are you sending FireServer on client or server?

Sending from client, and getting from script inside plugin folder.

1 Like

Hmm idk then maybe it just doesn’t send from client to script in a plugin?

Uhh, is this is a bug? It was working couple days ago -_-

1 Like

Plugins in Studio run in the server context, thus OnServerEvent would not work. Why are you setting up remotes for plugins?

There is a case where plugins in Play Solo run in the client context alongside their server-side versions, but that’s a whole other ordeal.

1 Like

Okay so what can i do now? It was working before. I need to send textbox information to server… I can’t save datastores from local.

1 Like

Is this a plugin? Are you in Studio and not play solo? If so, you’re already in the server context

Its a datastore editor plugin, when you enter a key event fires.

1 Like

But plugins run in server-side context, so you don’t need to fire any events. You can just call the DataStore from that context.

1 Like

Sorry my first time at plugins, are you telling about saving from local script or just getting the text info from server script

1 Like

Your plugin is not running on the client (unless you’re using it from Play Solo), so the code running in the plugin is in a server-side context. Therefore, your plugin has the ability to directly call the data store.

1 Like

Okay, so im saving from local script right? Sorry im asking too much questions.

1 Like