Is it possible to connect Python to a Roblox game?

I have a python script which generates strings continuously. Would it be possible to somehow send that data over to a Roblox game, which would run a function? Like some way to connect the Roblox game to something, and everytime that something sends data, the game picks it up and runs a function.

I’ve looked into the Roblox HttpRequest docs and Api wrappers such as Pyblox3 but they all seem to be directed towards Web sided things like groups, friendlists and etc. But what I really want is to send data over to a game and change things in the game in real time.

Thanks for your help!

2 Likes

You can’t directly listen to the data like you do for events, but you can temporarily store said data somewhere and have a loop that checks every x amount of seconds that place for new data. For this, you will need to send an HTTP request to the URL storing the data from Roblox using HttpService. I also suggest implementing some kind of authentication for that URL, so that said data can only be accessed from that specific Roblox game/server and your Python script that is writing to it.

Also, keep in mind Roblox servers allow 500 HttpService requests per minute, so the least possible wait of checking said data is 60/500 = 0.12. However, I suggest you use a more logical delay such as 0.5 or 1.

1 Like

Yeah I feared it wasn’t possible. I thought about requesting a pastebin url every second but the 500 requests limit would stop me from achieving what I want. I’m going to abandon that whole idea and try another way of doing things. Thanks a lot!

It’s per minute, 500 requests within a minute. For context, waiting 0.5 seconds only make 120 requests per minute, so that leaves you with 380 extra possible requests during that time.

Also, that can be artificially increased if you take the work off Roblox, by making your server make the requests instead and then asking your server to bulk send the current data of let’s say 5 sites/URLs at once.

2 Likes

I didn’t realize it was per minute, that’s generous. I might try that method afterall and see how well that works.

1 Like

You can also use Open Cloud to push your data into your game by MessagingService.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.