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

How to make a value that counts game visits?

Asked by
imKirda 4491 Moderation Voter Community Moderator
4 years ago

I have a problem, i want to make a value that will count game visits, i have idea how this could work but i do not know how.

My idea:

local placeId = 12345678 local value = script.Parent

value.Value = placeId.VisitCount -- This does not work but should work like that I GUESS.

Please help. Thanks, kirda.

1
You will need to know how to use https Service Nguyenlegiahung 1091 — 4y
0
no u just need datastore HappyTimIsHim 652 — 4y
0
nvm HappyTimIsHim 652 — 4y
0
Thanks, at least i know what to work with. imKirda 4491 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
local ds = game:GetService("DataStoreService")
visits = ds:GetDataStore("Visits")
game.Players.PlayerAdded:Connect(function(plr)
    local data
    local suc, err = pcall(function()
        data = visits:GetAsync("Visits")
    end)
    if suc then
        visits:SetAsync(data + 1)
    end
    data = data + 1
end)

I really don't recommend this but it's a weird way to save visits and might not count every visit so... idk listen to Nguyenlegiahung use https service

Ad

Answer this question