How do i make a script that counts the current game like that refreshes every 60 minutes? I tried some codes using external sites but i had 2 type of errors, 403 Forbidden and Can’t parse JSON…
Thanks!
How do i make a script that counts the current game like that refreshes every 60 minutes? I tried some codes using external sites but i had 2 type of errors, 403 Forbidden and Can’t parse JSON…
Thanks!
You need to use a proxy. You can’t use Roblox servers to send requests to Roblox.
What do you mean with this? I used 3rd party site to get the fame current liked but i got those errors
Are you using GET
requests or RequestAsync
requests?
This is the script:
local HttpService = game:GetService("HttpService")
local UniverseId = 3890366244
local formatNumber = (function (n) n = tostring(n) return n:reverse():gsub("%d%d%d", "%1,"):reverse():gsub("^,", "") end)
while true do
local response = HttpService:RequestAsync({
Url = "https://games.roproxy.com/v1/games/votes?universeIds="..UniverseId,
Method = "GET"
})
local votes = HttpService:JSONDecode(response.Body)
workspace.l.SurfaceGui.TextLabel.Text = " Likes: "..formatNumber(votes.data[1].upVotes)
task.wait(60)
end
When you were getting the Can’t parse JSON error, what was the response?
Nothing, the label didn’t updated and i got only this
What does it say when you do print(response)
before setting the label or getting the votes JSON?
It printed me an HTML code:
21:01:03.043 {
[“Body”] = "
<script>
(function(){function d(c){var b=document.getElementById("copy-label"),a=document.getElementById("cf-details-wrapper-expandable");c.target.checked?a.classList.add("expanded"):(a.classList.remove("expanded"),b.innerText="Click to copy")}if(document.addEventListener){var e=function(){var c=document.getElementById("copy-label");var b=document.getElementById("error-details").textContent;if(navigator.clipboard)navigator.clipboard.writeText(b);else{var a=document.createElement("textarea");a.value=b;a.style.top="0";a.style.left="0";a.style.position="fixed";document.body.appendChild(a);a.focus();a.select();document.execCommand("copy");document.body.removeChild(a)}c.innerText="Copied text to clipboard"};document.addEventListener("DOMContentLoaded",function(){var c=document.getElementById("error-details-checkbox"),b=document.getElementById("click-to-copy-btn");document.getElementById("copy-label").classList.remove("hidden");c.addEventListener("change",d);b.addEventListener("click",e)})}})();
</script>
<script defer src="https://performance.radar.cloudflare.com/beacon.js"></script>
You do not have access to games.roproxy.com.
The site owner may have set restrictions that prevent you from accessing the site.
Error details
<input id="error-details-checkbox" class="hidden" type="checkbox">
<div class="cf-expandable-error-info hidden">
<p class="cf-error-copy-description">Provide the site owner this information.</p>
<button class="cf-click-to-copy-btn" id="click-to-copy-btn" title="Click to copy" type="button">
I got an error when visiting games.roproxy.com/v1/games/votes?universeIds=3890366244.
Error code: 1020
Ray ID: 7b6579d338e50dfa
Country: IT
Data center: mxp02
IP: -----
Timestamp: 2023-04-11 19:01:02 UTC
Click to copy
<div class="clearfix cf-footer cf-section" role="contentinfo">
<div class="cf-column">
<div class="feedback-hidden py-8 text-center" id="error-feedback">
<div id="error-feedback-survey" class="footer-line-wrapper">
Was this page helpful?
<button class="border border-solid bg-white cf-button cursor-pointer ml-4 px-4 py-2 rounded" id="feedback-button-yes" type="button">Yes</button>
<button class="border border-solid bg-white cf-button cursor-pointer ml-4 px-4 py-2 rounded" id="feedback-button-no" type="button">No</button>
</div>
<div class="feedback-success feedback-hidden" id="error-feedback-success">
Thank you for your feedback!
</div>
</div>
<div class="cf-column cf-footer-line-wrapper text-center">
<p>
Performance & security by <a rel="noopener noreferrer" href="https://www.cloudflare.com?utm_source=1020_error" target="_blank">Cloudflare <img class="external-link" title="Opens in new tab" src="/cdn-cgi/images/external.png" alt="External link"></a>
</p>
</div>
</div>
",
["Headers"] = {...},
["StatusCode"] = 403,
["StatusMessage"] = "Forbidden",
["Success"] = false
} - Server - Likes:12
I think the access to the site is denied
Yeah, it seems like it. I think you should use a newer API endpoint.