Hello,
why I do not get the same things about “dataPlayer” ? It’s the same process but I do not get the same data…
Normal: {"ap":100,"ban":true,"banReason":"TK","endBan":0,"name":"ptitloup132","rank":"Premier"}
No normal: {"816024195":{"ap":100,"ban":true,"banReason":"TK","endBan":0,"name":"ptitloup132","rank":"Premier"},"FORMAT":{"ap":0,"ban":false,"banReason":"N/A","endBan":0,"name":"username","rank":"Rookie"}}
Module script:
local FirebaseService = require(game:GetService("ServerScriptService"):WaitForChild('FirebaseService'))
local database = FirebaseService:GetFirebase("players");
local BanMan = {}
BanMan.update = function(playerID, value, reason)
local dataPlayer = database:GetAsync(playerID)
local sendData = game:GetService("HttpService"):JSONDecode(dataPlayer)
sendData["ban"] = value
sendData["banReason"] = reason
database:SetAsync(playerID, game.HttpService:JSONEncode(sendData))
end
BanMan.banned = function(playerID)
local dataPlayer = database:GetAsync(playerID)
print(dataPlayer) -- Normal
local sendData = game:GetService("HttpService"):JSONDecode(dataPlayer)
return sendData.ban
end
BanMan.getReason = function(playerID)
local dataPlayer = database:GetAsync(playerID)
print(dataPlayer) --Problem here
local sendData = game:GetService("HttpService"):JSONDecode(dataPlayer)
return sendData.banReason
end
return BanMan
Data (from firebase):
If you do not know where do I found scripts to communicate with Firebase: Firebase Database Tutorial