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.

1 comment

0

Kind of an advanced thing to be doing since I'm still on the newer side of rbx.Lua...