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

DataStores aren't working cross-server, only on the local server?

Asked by 5 years ago

I've tried multiple things including OnUpdate and using a loop with GetAsync. They work on the server you're in just not cross-server. It's annoying because I really need it. I've heard it's buggy but this is really getting on my nerves. Here's an example I took, but it should work.

ds = game:GetService("DataStoreService"):GetDataStore("colorstore")             --initializes DataStore as 'ds'

while true do
    print(ds:GetAsync("colorkey"))
    wait(.1)
    if ds:GetAsync("colorkey") == 1 then                                    -- Sets block to red when "colorkey" value is 1
        script.Parent.BrickColor = BrickColor.new(Color3.new(1, 0, 0))
    elseif ds:GetAsync("colorkey") == 2 then                                -- Sets block to blue when "colorkey" value is 2
        script.Parent.BrickColor = BrickColor.new(Color3.new(0, 0, 1))
    else                                                                    -- Sets block to white when neither condition is met
        script.Parent.BrickColor = BrickColor.new(Color3.new(1, 1, 1))
    end
end

Here's the button script...

ds = game:GetService("DataStoreService"):GetDataStore("colorstore")

function onTouched(hit)
    ds:SetAsync("colorkey", 2)
    end

script.Parent.Touched:connect(onTouched)

Again this isn't my example but it was posted on the dev forum and confirmed working. Thanks in advance.

1 answer

Log in to vote
1
Answered by 5 years ago

The first script has a while loop that accesses the datastore without breaking, which causes throttling. There's a limit on how many times you can access the datastore through SetAsync() or GetAsync(): http://robloxdev.com/articles/Data-store#Limitations

0
Alright but the problem here I have is when I use OnUpdate it still doesn't detect it cross server with a non-loop. TheSimplePixel 5 — 5y
Ad

Answer this question