Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
LM-loleris committed Oct 11, 2024
2 parents fd5b38e + 9519994 commit 3a91c68
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Examples/DeveloperProductExample.server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function PurchaseIdCheckAsync(profile, purchase_id, grant_product_callback) -->
table.remove(local_purchase_ids, 1)
end
table.insert(local_purchase_ids, purchase_id)
coroutine.wrap(grant_product_callback)()
task.spawn(grant_product_callback)
end

-- Waiting until the purchase is confirmed to be saved:
Expand Down Expand Up @@ -173,7 +173,7 @@ end
----- Initialize -----

for _, player in ipairs(Players:GetPlayers()) do
coroutine.wrap(PlayerAdded)(player)
task.spawn(PlayerAdded, player)
end

MarketplaceService.ProcessReceipt = ProcessReceipt
Expand All @@ -187,4 +187,4 @@ Players.PlayerRemoving:Connect(function(player)
if profile ~= nil then
profile:Release()
end
end)
end)
4 changes: 2 additions & 2 deletions Examples/PlayerProfileExample.server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ local function PlayerAdded(player)
else
-- The profile couldn't be loaded possibly due to other
-- Roblox servers trying to load this profile at the same time:
player:Kick()
player:Kick()
end
end

----- Initialize -----

-- In case Players have joined the server earlier than this script ran:
for _, player in ipairs(Players:GetPlayers()) do
coroutine.wrap(PlayerAdded)(player)
task.spawn(PlayerAdded, player)
end

----- Connections -----
Expand Down
7 changes: 2 additions & 5 deletions ProfileService.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2253,21 +2253,18 @@ function ProfileService.GetProfileStore(profile_store_index, profile_template) -
}
setmetatable(profile_store, ProfileStore)

local options = Instance.new("DataStoreOptions")
options:SetExperimentalFeatures({v2 = true})

if IsLiveCheckActive == true then
profile_store._is_pending = true
task.spawn(function()
WaitForLiveAccessCheck()
if UseMockDataStore == false then
profile_store._global_data_store = DataStoreService:GetDataStore(profile_store_name, profile_store_scope, options)
profile_store._global_data_store = DataStoreService:GetDataStore(profile_store_name, profile_store_scope)
end
profile_store._is_pending = false
end)
else
if UseMockDataStore == false then
profile_store._global_data_store = DataStoreService:GetDataStore(profile_store_name, profile_store_scope, options)
profile_store._global_data_store = DataStoreService:GetDataStore(profile_store_name, profile_store_scope)
end
end

Expand Down
8 changes: 4 additions & 4 deletions ProfileTest.server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ local ServerScriptService = game:GetService("ServerScriptService")
local ProfileService
do
local did_yield = true
coroutine.wrap(function()
task.spawn(function()
ProfileService = require(ServerScriptService.ProfileService)
did_yield = false
end)()
end)
if did_yield == true then
error("[ProfileTest]: ProfileService ModuleScript should not yield when required!")
end
Expand Down Expand Up @@ -182,7 +182,7 @@ if ProfileTest.TEST_MOCK == true then
print("[MOCK]")
end

coroutine.wrap(function()
task.spawn(function()

print("RUNNING PROFILE TEST")

Expand Down Expand Up @@ -665,4 +665,4 @@ coroutine.wrap(function()
profile11:Reconcile()
TestPass("ProfileService test #11", profile11.Data.Counter == 0 and profile11.Data.Array == false and type(profile11.Data.Dictionary) == "table")

end)()
end)
4 changes: 2 additions & 2 deletions docs/tutorial/basic_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ end

-- In case Players have joined the server earlier than this script ran:
for _, player in ipairs(Players:GetPlayers()) do
coroutine.wrap(PlayerAdded)(player)
task.spawn(PlayerAdded, player)
end

----- Connections -----
Expand All @@ -94,4 +94,4 @@ Players.PlayerRemoving:Connect(function(player)
profile:Release()
end
end)
```
```
6 changes: 3 additions & 3 deletions docs/tutorial/developer_products.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function PurchaseIdCheckAsync(profile, purchase_id, grant_product_callback) -->
table.remove(local_purchase_ids, 1)
end
table.insert(local_purchase_ids, purchase_id)
coroutine.wrap(grant_product_callback)()
task.spawn(grant_product_callback)
end

-- Waiting until the purchase is confirmed to be saved:
Expand Down Expand Up @@ -172,7 +172,7 @@ end
----- Initialize -----

for _, player in ipairs(Players:GetPlayers()) do
coroutine.wrap(PlayerAdded)(player)
task.spawn(PlayerAdded, player)
end

MarketplaceService.ProcessReceipt = ProcessReceipt
Expand All @@ -187,4 +187,4 @@ Players.PlayerRemoving:Connect(function(player)
profile:Release()
end
end)
```
```

0 comments on commit 3a91c68

Please sign in to comment.