In a ModuleScript called from a Server Script within ServerScriptStorage I'm trying to use GetAsync with a datastore when a new index is created in a metatable.
However, I run it and I get this error.
15:18:44.513 - attempt to yield across metamethod/C-call boundary
--Stack stuff
15:18:44.903 - cannot resume non-suspended coroutine
--Stack stuff
I think it has something to do with ROBLOX's Thread Scheduler, but I've used datastores before and never had a problem. Does anybody know why this would error?
local playerData = setmetatable({}, { __newindex = function(self, index, plr) local data = gds:GetAsync(plr.userId .. "Data") -- Error end; }) game.Players.PlayerAdded:Connect(function(plr) playerData[#playerData + 1] = plr end)
I don't know much about meta-tables, but have you checked they can be converted into a JSON string? Roblox datastore saves data as JSON.