I tried using apis but can’t understand really how to use them please help :
local players = game:GetService("Players")
local HTTP = game:GetService("HttpService")
local ProxyService = require(game:GetService('ServerScriptService').ProxyService)
local Proxy = ProxyService:New('https://devplaceroblox.herokuapp.com', 'acceskeywontshare')
local Time_Cap = 35
local function OnAdded(player)
print("welcome, ", player.Name)
local id = player.UserId
local endpoint, place_details = how to get the player profile and check the visits
local data, tries, completed = nil, 0, false
local ids, visits = {}, {}
ids[player.Name] = {}
visits[player.Name] = 0
coroutine.wrap(function()
local started = os.time()
while not completed do
if os.time() - started >= Time_Cap then print("aborting operation") -- can be eliminated with an 'and' above
return
end
wait(0.2)
end
end)()
while not data and tries < 4 do
pcall(function()
data = HTTP:GetAsync(endpoint)
end)
tries += 1
wait(3)
end
if data then
data = HTTP:JSONDecode(data).data
for _, value in pairs(data) do
table.insert(ids[player.Name], value.id) print("inserted place id: ", value.id)
end
end
local throttle = 0
for _, id in pairs(ids[player.Name]) do
if throttle == 5 then wait(4) throttle = 0 end
pcall(function()
data = HTTP:GetAsync(place_details..id)
end)
if data then
data = HTTP:JSONDecode(data).data[1]
visits[player.Name] += tonumber(data.visits) print("added visits: ", data.visits)
end
throttle += 1
end
player.leaderstats.PlaceVisits.Value = visits[player.Name]
end
players.PlayerAdded:Connect(OnAdded)