Hello,
I made a visits board to track visits, but it only works half of the time, takes a long time to do anything, and then does not do the stuff.
This is the code:
local url = "https://proxy.darkpixlz.com"
local TestMode = false
local CurrentMilestones = {
["2893561122"] = {
Name = "Clean up Roblox",
Milestone = 15000000
},
["3738187684"] = {
Name = "Clean up Friends",
Milestone = 700000
},
["3388927778"] = {
Name = "Ragdoll Is Everywhere",
Milestone = 40000
},
["4092528444"] = {
Name = "Stud Jumper",
Milestone = 20000
},
--3388927778
}
local function Update()
for i,v in ipairs(script.Parent:GetDescendants()) do
if type(tonumber(v.Name)) == "number" then
local CurrentMilestone = CurrentMilestones[v.Name]["Milestone"]
--local CurrentMilestone = 2
local ID = v.Name
local Store = game:GetService("DataStoreService"):GetDataStore(ID..CurrentMilestone)
local DataLikes = game:GetService("HttpService"):JSONDecode(game:GetService("HttpService"):GetAsync(url.."/games/v1/games/votes?universeIds="..tostring(v.Name), true))
local Likes = DataLikes["data"][1]["upVotes"]
v.Likes.Text = tostring(Likes).." Likes"
-- Literally all other data, thanks Roblox
local Data = game:GetService("HttpService"):JSONDecode(game:GetService("HttpService"):GetAsync(url.."/games/v1/games?universeIds="..tostring(v.Name), true))["data"][1]
local Visits = Data["visits"]
if Visits >= CurrentMilestone and not Store:GetAsync("ShouldNotHappen") then
--if true then
script.Sound:Play()
for i,v in ipairs(script.Parent.Parent.Parent.Parts:GetChildren()) do v.Enabled = true end
local Tween = game:GetService("TweenService"):Create(game.Lighting, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {ClockTime = 0})
Tween:Play()
game.ServerScriptService["Misc."].Fireworks.Enabled = true
task.spawn(function()
task.wait(math.random(5,15))
if not Store:GetAsync("HasAnnounced") then
Store:SetAsync("HasAnnounced", true)
game:GetService("HttpService"):PostAsync("--[]", game:GetService("HttpService"):JSONEncode({["content"] = "@everyone **"..CurrentMilestone.." Visits on "..CurrentMilestones[v.Name].Name.." reached!**"}))
end
for i, v in ipairs(game.Players:GetPlayers()) do
game:GetService("BadgeService"):AwardBadge(v.UserId, 2141218207)
end
task.wait(math.random(30,60))
for i,v in ipairs(script.Parent.Parent.Parent.Parts:GetChildren()) do v.Enabled = false end
Tween = game:GetService("TweenService"):Create(game.Lighting, TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0), {ClockTime = 12})
Tween:Play()
game.ServerScriptService["Misc."].Fireworks.Enabled = false
Store:SetAsync("ShouldNotHappen", true)
end)
end
local Playing = Data["playing"]
local Favorites = Data["favoritedCount"]
v.Favorites.Text = tostring(Favorites).." Favorites"
v.Visits.Text = tostring(Visits).." Visits"
v.InGame.Text = tostring(Playing).." Playing"
end
end
end
while task.wait(math.random(5,15)) do
-- Likes
repeat
local succ, err = pcall(function()
Update()
end)
if not succ then
warn("[Visits Board]: Error: "..err)
end
until succ
end
A lot of the time, there is no result, no error, nothing. Thanks for any support.