Control script with discord

Hi, is it possible that I can control a script with a Discord Command or something like that, e.g. deactivate it? My idea was that when a script loads for the first time and then sends a message to a Discord channel with a button tone where I can control it. Is something like this possible?

Sure!
Let’s just start simple. This is a kick script trough discord to roblox.

  1. Create a Discord bot and invite it to your server. You can find tutorials online for how to do this.
  2. Create a webhook for your Discord server. This will allow you to send messages to the server from your Roblox game. You can find more information about how to create a webhook in the Discord documentation.
  3. In your Roblox game, use the HttpService to send a message to the Discord webhook when you want to kick a player. Here is an example of how you can do this:
local HttpService = game:GetService("HttpService")
local webhookUrl = "YOUR_WEBHOOK_URL" -- replace this with the URL of your Discord webhook

function kickPlayer(playerId)
  local message = {
    content = string.format("Player %s has been kicked", playerId) -- the message to send to Discord
  }
  local response = HttpService:PostAsync(webhookUrl, HttpService:JSONEncode(message))
  print(response) -- print the response from the webhook to the output
end

-- example usage: kick the player with playerId 12345
kickPlayer(12345)
  • In your Discord server, set up a bot command that sends a message to the webhook with the player’s ID when you want to kick them. For example, you could set up a command like !kick 12345 to kick the player with playerId 12345.

  • In your Roblox game, use the Players service to get the player object for the player you want to kick, and use the Kick function to kick them from the game. Here is an example of how you can do this:

local player = game.Players:GetPlayerById(playerId) -- get the player object for the player you want to kick
player:Kick() -- kick the player from the game

Now lets finish the discord bot!
We will imagine you do this in python because it’s easy and lightweight.

NOTE: This is from my own discord bot and you need to patch some things to make it work with roblox!

  • To create a Discord bot in Python, you will need to install the discord.py library and use it to interact with the Discord API. Here is an example of a simple Discord bot that sends a message to a channel when it is run:
import discord

# create a Discord client object
client = discord.Client()

# define an event handler for when the bot is ready
@client.event
async def on_ready():
    # get the default channel for the server
    default_channel = client.get_guild(YOUR_GUILD_ID).default_channel
    # send a message to the default channel
    await default_channel.send("Hello, world!")

# start the bot
client.run("YOUR_BOT_TOKEN")

To use this code, you will need to replace YOUR_GUILD_ID with the ID of the server where you want the bot to send the message, and YOUR_BOT_TOKEN with the token for your bot, which you can get from the Discord Developer Portal.

This code creates a Discord client object and defines an event handler for the on_ready event, which is triggered when the bot is ready to start. The event handler sends a message to the default channel for the server.

Finally, the code calls the run method of the client object to start the bot. You can find more information about the discord.py library and the Discord API in the Discord API documentation (Welcome to discord.py).

And know the rest is up to you. You can set it up with basic steps.
I hope this helps! Let me know if you have any questions or need further assistance.

I put the script into my Roblox game and every time I start the game, a message is sent to the Discord channel and an empty message is sent to the console in the game, but what exactly should the Discord bot do now?

As is said its easy to modify the code and go on your own. Use the info I have provided you.