Add custom Discord Rich Presence to your game with BloxstrapRPC

Did you know that you can add Discord Rich Presence functionality to your own game? Thanks to BloxstrapRPC, you can do just that!

Some of you may already know what Bloxstrap is, some of you may not. One of its main standout features is the ability for it to show what game you’re playing through Discord Rich Presence. However, on top of this, it also provides the ability for games to control and customize what the Rich Presence looks like - but how?

Bloxstrap features BloxstrapRPC, a general-purpose one-way RPC mechanism for Roblox games to send data to external applications running on your computer. It’s intended to be more than just for Rich Presence, but right now that’s its only feature.

Here are some examples of developers who have integrated it into their games:

I’ll just clarify that you need to have a BloxstrapRPC-compatible application running on your computer for this to work. As of right now, there are three that exist: Bloxstrap (Windows only), Vinegar, and Applejuice (both Linux only). Though, anyone is free to make their own implementation of BloxstrapRPC. So, I’d say it’s worth looking into adding, even if you don’t or can’t use it.

Getting started

I’d recommend that you read up on the documentation for BloxstrapRPC, but I’ll briefly cover on how to get started with it here.

The BloxstrapRPC SDK provides you with everything that you’ll need, so go ahead and add that to your game. You can get it via the Roblox marketplace, roblox-ts, Wally, or GitHub.

Once you’ve done that, in any LocalScript, you can import it and call its methods. See the documentation for all the methods and types it makes available.

Here’s an example script that sets the user’s rich presence as soon as they join the game.

local BloxstrapRPC = require(game.ReplicatedStorage.BloxstrapRPC)

local timestamp = os.time()
  
BloxstrapRPC.SetRichPresence({
    details = "Example details value",
    state = "Example state value",
    timeStart = timestamp,
    timeEnd = timestamp + 60,
    largeImage = {
        assetId = 10630555127,
        hoverText = "Example hover text"
    },
    smallImage = {
        assetId = 13409122839,
        hoverText = "Example hover text"
    }
})

To test this out, publish the game to Roblox, and join it with Bloxstrap installed, and you should see this show up on your Discord profile.

image

It’s that easy! There is behaviour for persisting or resetting fields, so that you don’t need to re-specify all of the fields just for updating one thing. All of that is detailed in the documentation, of course.

Let me know how well it works for you, what you’d like to see be added, or if you have any problems using it.

Special thanks to @ElusiveEpix for suggesting this idea, and helping me out with this.

89 Likes

I like this idea! I’ll definitely use this in my games. I feel like bloxstrap users should be able to block these requests, though.

Malicious games could set their status to something inappropiate. So basically, I’d like just an extra setting to turn off custom presences!

3 Likes

That’s true, but that goes for basically any game you play, not just Roblox. By the way, stuff like that likely wouldn’t go undetected by Roblox due to the way BloxstrapRPC works.

2 Likes

Is it really done with print??

That’s… really unfortunate. I like my output clean. :fearful:

I made a solution with HttpService:RequestAsync, to then remember you can’t call that crap on the client anyways. Wish it would let you make requests to localhost on the client. It’s localhost for a reason.

How exactly is Bloxstrap detecting these print messages? If it’s injecting some sort of script, couldn’t it be done another way?

2 Likes

Tracks the log file. Documentation explains the implementation if you scroll down. It does it 100% cleanly.

IMO the efficiency and reliability of it outweighs the clutter it creates, which won’t be much anyway.

2 Likes

Would it work if I were to use game.LogService:ClearOutput() a frame after the print? Or does Bloxstrap check every second or something like that?

Opinions: This is actually really useful considering out powerful this can be for letting friends track the statistics like round, wins, and etc. (Either creeps or friends with curiosity) Even though this is only an optional extension, but cool to think about how Bloxstrap being most known unofficial launcher can give Roblox games standalone game features.

I’d like to see custom button interaction being a thing in BloxstrapRPC. For security and safety measures, in case of bad actors using the RPC though, it can be locked to official links (Roblox, YouTube) on the program.

3 Likes

LogService:ClearOutput only works in Studio for obvious reasons. Why would it even work in the client?
Even if it did, it would be too dangerous to have the log file just nuked by a simple method call

2 Likes

That’s certainly possible, but I’m somewhat debating over the use cases for those, lol.

3 Likes

This is a really great addition to Bloxstrap, but isn’t there a way to avoid using print to update the presence?
One easy thought would be sending data over localhost, but i’m not sure what could be the implications for using this way. Nevermind, i forgot that HttpService doesn’t work this way.

It would be pretty useful for games with lobbies. For example there would be a button in the RPC and when you press it, it would make you join the game with custom join data (if possible, I don’t remember if roblox allows you to do that).

1 Like

This would be definitely possible thanks to Developer Deeplinking:

This would be great for joining a lobby, entering a reserved server (if the game has a custom VIP server implementation), sending an invite to join an in-game crew, etc.

1 Like

Yep, we have plans to add support for that!

3 Likes

Can you guys explain steps in a youtube video or something ?

What do you not understand from the information I provided in the original post?

3 Likes

Hello, what i meant is i don’t know how to do this that all, that why i asked for a video or somthing/steps

Add the ModuleScript to your game. Require it in a LocalScript somewhere. Use the functions provided by the ModuleScript export, and that’s about it

1 Like

How do I get Discord to detect Bloxstrap? Its not automatically detected in the “Registered Games” section. How do I fix this?

Also, what does timeStart and timeEnd do?
What is the difference between the big and small image? where are they even shown?

It should just work when you join a game. If it doesn’t, let me know and I’ll help figure out what’s going on.

Sets the start timestamp and the end timestamp. In the example code, I set the duration to 60 seconds, and the image, you can see it says “00:51 left”.

Did you see the example?

image

1 Like

Very cool that Bloxstrap can do this. Thanks!
I’ve implemented it myself into a game I work on

f1fc87de6bbef239af67fad0da4a73ea
image

This will be great to allow players to join directly into parties with their friends through Discord

2 Likes