New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

GetAsnyc is not a valid member of Global data store?

Asked by 4 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 8057 Badge of Merit Moderation Voter Administrator Community Moderator
4 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 885 — 4y
Ad

Answer this question