Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

GetAsnyc is not a valid member of Global data store?

Asked by 10 years ago

I'm testing stuff out with data stores, and when I tried this script it said GetAsnyc is not a valid member of data store. I did everything correctly what the wiki said to do.

Script:

local ds = game:GetService("DataStoreService"):GetDataStore("TestColor")

while true do
    wait()
    if ds:GetAsnyc("color") == 1 then
        script.Parent.BrickColor = BrickColor.new("Bright blue")
    elseif ds:GetAsnyc("color") == 2 then
        script.Parent.BrickColor = BrickColor.new("Bright red")
    else
        script.Parent.BrickColor = BrickColor.new("Institutional white")
    end
end

1 answer

Log in to vote
2
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
10 years ago

GetAsync - you had a typo lol, also DataStores can only have 100 requests per minute server-wide.. by only having wait() for a yeild in your loop(1/30 seconds) you're going to exceed the limit a lot.. So I put wait(5). Also I revised your script a bit.

local ds = game:GetService("DataStoreService"):GetDataStore("TestColor")
local colors = {BrickColor.new('Bright blue'),BrickColor.new('Bright red'),BrickColor.new('Institutional white'}

while wait(5) do
    script.Parent.BrickColor = colors[ds:GetAsync('color')] or BrickColor.new('Dark stone grey')
end
0
Thx! Typos xD Operation_Meme 890 — 10y
Ad

Answer this question