Hello developers, I have a script below that creates a table in firebase if there isnt already one for the player in the database. However the table comes out as
When it should just have that player ID and the miles, not any of the -NMOk8NN_z0KTZtNX0qD
How would I fix this?
local Data = HttpService:JSONDecode(HttpService:GetAsync(URL))
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = Player
local Miles = Instance.new("StringValue")
Miles.Name = "Points"
Miles.Parent = leaderstats
local Table = {
[Player.UserId] = {
["Miles"] = 0
}
}
if Data[tostring(Player.UserId)] then
Miles.Value = Data[tostring(Player.UserId)].Miles
else
print(Player.Name .. " is not in the database.")
Miles.Value = 0
local data = HttpService:RequestAsync(
{
Url = URL,
Method = "POST",
Headers = {
["Content-Type"] = "application/json"
},
Body = HttpService:JSONEncode(Table)
}
)
print(data)
end