Firebase Datastore Not Working

Hey everyone, I’m using Firebase to store my stuff, now before you say no, I cannot switch from firebase to roblox, as it’s already scripted that way.

I just simply need some help.
I’m getting this error:
image
Then once another person joins it says: FirebaseService>> [ERROR] HTTP 401 (Unauthorized)

Heres my database store script if it helps:
I can also show you the FirebaseService module, which has my firebase database link(url) and auth token.

local db = mod:GetFirebase('Saves')
local dss = game:GetService("DataStoreService"):GetDataStore('SAVINGALLPOINTSFORNOW2091VI12')
local http = game:GetService("HttpService")
while wait(240) do
	
	for i,plr in pairs(game.Players:GetPlayers()) do
		if plr ~= nil then
			if plr:findFirstChild('LuxyBuxLoaded') then
				if plr:findFirstChild('Stats') and plr:findFirstChild('leaderstats') then
				
					if plr.Stats:findFirstChild('LuxyBux') then
						local success,response = pcall(function()
							db:SetAsync(tostring(plr.UserId).."/LuxyBux",plr.Stats.LuxyBux.Value)
							return;
						end)
						local success2,response2 = pcall(function()
							db:SetAsync(tostring(plr.UserId).."/WorkerPoints",plr.leaderstats["Worker Points"].Value)
							return;
						end)
						
						local success3, response3 = pcall(function()
							local count = 0
							if game.ServerStorage:FindFirstChild("BlockSaves") then
								if plr:findFirstChild('PetsLoaded2') and game.ServerStorage.BlockSaves.Value == false then
									
									if plr:findFirstChild('Pets')   and game.ServerStorage.BlockSaves.Value == false then
										local petstable = {}
										
										for i,v in pairs(plr.Pets:GetChildren()) do

											if v.Value >= 1 then

												count = count + v.Value

											end


											if v.Value > 0 then
												petstable[v.Name]=v.Value
											end


										end
										if   game.ServerStorage.BlockSaves.Value == false then
											db:SetAsync(tostring(plr.UserId.."/Pets/Inventory"),http:JSONEncode(petstable))
										end
									end
								
									db:SetAsync(tostring(plr.UserId).."/Pets/PetCount",count)



								end
							end
							return;
						end)
						
						if success == true and success2 == true and success3 == true then
							game.ReplicatedStorage.SendNotification:FireClient(plr,"AutoSaveSuccess",nil)
							print('Saved '..plr.Name.."'s LuxyBux")	
						else
							print("Failed saving ".. plr.Name .. "'s Data")
							game.ReplicatedStorage.SendNotification:FireClient(plr,"AutoSaveFail",nil)
						end
						
						
					end
				
				end
			end
		end
		
		wait(1)
	end
	print('Saving done')
end```
4 Likes