How to control roblox with discord bot?

So, I’ve nearly finished my discord bot for my group, but I want to take it a bit more further.

I was gonna make a new command category called “Game”, where a certain rank can run discord commands to do actions in a Roblox server.

I can imagine this not being simple, but I know it’s possible.

My bot is written in Javascript (node.js), and uses discord.js and noblox.js; discord.js is irrelevant to this question.

Some of the command ideas I had are:

  • ?gamekick (roblox username)
  • ?gameban (roblox name) (prefer to ban using a roblox datastore?)

But that’s not really the point, the point is how do I connect discord to roblox?

Thnaks if you can help.

2 Likes

I recently discovered something called long polling which is great for communication from an external server to Roblox. This article does a great job at explaining it Realtime Push to Roblox Game Servers via HTTP Long Polling | Matthew Dean

2 Likes

You’ll need to expose an endpoint of an intermediary server and make some kind of a database. Roblox doesn’t have any viable way of running a single script for an entire universe, so everything will have to be handled by the bot.

Bans are easy to make. Send a request when a player joins, check if they are marked as banned in the database and return that value.

Kicks are a bit trickier, but should be possible with a hacky solution.

1 Like

Heres a really good example of almost exactly whats mentioned in your post without the noblox.js side

2 Likes

You can set up a server and send requests to it. For a ban system, you can store the banned users in a database on your server. For kicking, you can keep sending requests to your server until the server indicates that there is an update.

2 Likes