GlobalDataStore:OnUpdate Behavior Changed (Again)

Reproduction Steps
Execute the following in a blank published place:

local DataStoreService = game:GetService("DataStoreService")
local Store = DataStoreService:GetDataStore("Test")

Store:SetAsync("Test", true)

local function onUpdate()
    print("Onupdate called")
end

Store:OnUpdate("Test", onUpdate)

while true do
    wait(5)
    print("Getting value")
    Store:GetAsync("Test")
end

Expected Behavior
Previously, OnUpdate would be called only when the value is changed, or the first time GetAsync is called on the key. The output would have beeen:

Getting value
Onupdate called
Getting value
Getting value
Getting value
. . .

Actual Behavior
Now, OnUpdate is called after any call to GetAsync. The output is:

Getting value
Onupdate called
Getting value
Onupdate called
Getting value
Onupdate called
Getting value
. . .

This is causing my game to crash itself constantly, because GetUpdate was used to check for a server shutdown signal sent from studio via DataStore (since MessagingService is not available from studio).

Issue Area: Engine
Issue Type: Other
Impact: Moderate
Frequency: Constantly
Date First Experienced: 2021-09-23 08:09:00 (-04:00)

6 Likes

This probably has something to do with the cloud games beta update. It’s been causing some publishing errors in my dev team.

OnUpdate is deprecated, so it would be a good idea to avoid using it altogether.

1 Like

Hi Defaultio,

Thanks for reporting this issue, just wanted to let you know that we are looking into this.

1 Like

@Defaultio could you please link to the experience(s) where you are seeing this issue?

I’ve patched in a workaround, but this was the affected game: test2 - Roblox

1 Like

As mentioned, Data Stores’ OnUpdate() method has been deprecated for a while, so I am closing this issue at this time.

1 Like