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

Getting place visits to a game in a universe?

Asked by 10 years ago

Title kinda explains it but this is code I have:

local DataStoreService = game:GetService("DataStoreService")
local StatisticsStorage = DataStoreService:GetDataStore("Statistics", "ServerData")

local function UpdateVisits(key)
    if key then
        return key + 1
    else
        return 1
    end
end
StatisticsStorage:UpdateAsync(place, UpdateVisits)

local DataStoreService = game:GetService("DataStoreService")
local StatisticsStorage = DataStoreService:GetDataStore("Statistics", "ServerData")
StatisticsStorage:OnUpdate("Visits", 
function(NewValue) 
    script.Parent.Text = ("Visits: "..NewValue)
end
)

I'm pretty certain this would only save the place visits of the main place in the universe.

0
Kind of an advanced thing to be doing since I'm still on the newer side of rbx.Lua... YellowoTide 1992 — 10y

Answer this question