Firebase Database not working

Good morning Developers!

I’ve been experiencing this issue with my Google Firebase Database. Everything work’s fine, however if your point’s change in-game, when you leave it doesn’t update on the database. I’ve been scratching my head for a couple of days now and can’t seem to find a solution. I added a catch to try and find an error but it’s not printing any errors at all.

Any help would be appreciated :heart:

game:GetService("Players").PlayerRemoving:Connect(function(p)
    local success, err = pcall(function()
        local sendData = {User_ID = p.UserId; Coins = p.pointsthings.Points.Value;}
        database:UpdateAsync(p.Name, game.HttpService:JSONEncode(sendData))
    end)
    
    if not success then
        print(err)
    end
end)

Maby you changed the value in a local script and it didn’t replicate to the server.

Are you testing in studio or in-game? if you are testing in studio are you sure that PlayerRemoving is actually firing? most of the time when testing in studio PlayerRemoving doesn’t fire quick enough before you leave so Instead you could kick yourself from the game or just test in a actual game

1 Like

I’ve tried both testing it in studio and in-game and it still doesn’t work.

When testing in studio does PlayerRemoving fire? if not try kicking your LocalPlayer and see if it fires then.

Seemingly not. I kicked my player and it’s not firing.