How would I remove this "folder" when sending data to Google Firebase Realtime Database

Hello, my script is working correctly but the data is always in a “folder” called -M… and I don’t know how to resolve this.
image

This is my code

local httpService = game:GetService('HttpService')
local URL = 'https://db.region.firebasedatabase.app/'
local AUTH_TOKEN = 'auth=secret'

game.Players.PlayerAdded:Connect(function(plr)
	
	local data = {
		["coins"] = 6500,
		["joined"] = true
	}
	
	data = httpService:JSONEncode(data)
	
	httpService:PostAsync(URL..tostring(plr.UserId)..".json?"..AUTH_TOKEN, data)
end)

Any help would be appreciated!

1 Like

The first question is why are you using Google’s datastore? Why can’t you just use roblox’s datastore that’s for Roblox games?

2 Likes

I just tried to see a bit how it works and if i could possibly use it in the future, but I use roblox’s datastore for my projects

2 Likes

Oh well I don’t really have experience with firebase or http service. I was just wondering why… Sorry

2 Likes

There’s no problem, I understand why you would want to know why I use Firebase

1 Like
1 Like

Thank you very much! Will try when I am available

1 Like

I ended up finding a way to check the user’s data. If anyone ever needs help, this is my code:

local httpService = game:GetService('HttpService')
local URL = 'https://database.region.firebasedatabase.app/'
local AUTH_TOKEN = 'auth=xxxxxxxxxxxxxxxxxxxxxxxx'

game.Players.PlayerAdded:Connect(function(plr)
	
	local data = {
		["coins"] = 6500,
		["joined"] = true,
		["userId"] = plr.UserId
	}
	
	data = httpService:JSONEncode(data)
	
	httpService:PostAsync(URL.."users.json?"..AUTH_TOKEN, data)
	
	wait(5)

	local result = httpService:JSONDecode(httpService:GetAsync(URL.."users.json?"..AUTH_TOKEN))
	
	for _, users in pairs(result) do
		for _, userData in pairs(users) do
			if type(userData) == "string" then
				local splitData = string.split(userData, ";")
				
				if splitData[1] == "id" then
					if tonumber(splitData[2]) == plr.UserId then
						print(splitData[2])
					end
				end
			end
		end
	end
end)
1 Like