Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Is there a way to connect to MySQL from roblox?

So by the title i mean is there a way i can save data,load data from roblox scripts to MySQL site and add / remove / update data values?

1 comment

0

REST API

1 answer

✓ Accepted answer

Yes but I believe you'll need a server to connect the two (don't know if you can skip it for MySQL)

How I send data over is like this, I use the JSONEncode function of HttpService to turn a table into a json string that can be sent and used on my web server

game.HttpService:JSONEncode({"connect",data,plr.Name,plr.UserId})

Then to get a response back

local response = game.HttpService:PostAsync("http://example.com",game.HttpService:JSONEncode({"connect",data,plr.Name,plr.UserId}))

You can use JSONDecode to turn json back into a table

Also if you were to use your recommended string you could use Concatenation to put in stuff from variables or things like that

local message = [[{
    "username":"]]..plr.Name[[..",
    "content": "]]..data.StringContent.Value..[[",
    "embeds": [{
        "description": "hii", 
        "title": "hiii", 
        "fields":[
        {"name":"hiiii", "value":"hiiiii"}, 
        {"name":"hiiiiii", "value":"hiiiiiii"}
        ]
    }]
}]]

1 comment

0

Thank you so much <3

This discussion is preserved as it was. New answers, comments, and votes are closed.