Need help with HTTP requests

Hey. I’m currently working on an automatical group rank bot, through a website called “Glitch”. When I actually fire the event, I get this error:

obrazek

The thing is, that I fire, or at least intend to fire only one event, meaning only make one HTTP Request. Therefore, I don’t understand why I am exceeding the request limit.

Code for the request function:

local GlitchURL = "https://sfpd-xpsystem-rankingbot.glitch.me/"

game.ReplicatedStorage.RankInGroup.OnServerEvent:Connect(function(UserId, RoleId)
	game:GetService("HttpService"):GetAsync(GlitchURL.."ranker?userid="..tostring(UserId).."&rank="..tostring(RoleId))
end)
2 Likes

If your remote event is running too many times, this would happen. Try printing something and see how much time it prints.

1 Like

The first arg to onServerEvent() is the Player object btw, you’ll need to add it before UserId. As the other poster said, your LocalScript is probably sending the event repeatedly.

1 Like

When firing the event, I’m already sending Player.UserId, so there shouldn’t be a problem.

No the first argument is always the player firing the event. You need to account for this even if you don’t use the player.

game.ReplicatedStorage.RankInGroup.OnServerEvent:Connect(function(Player, UserId, RoleId)
1 Like

Player isn’t the problem here, the remote event is running too many times.

1 Like

Stupid question but I have to ask. Does the service seem enabled in studio?

If you print this value

game:GetService(“HttpService”).HttpEnabled

In the command line, does it show as enabled?

Hmm, it actually keeps printing in a loop.

This print is giving me an error, but I think it’s just a studio issue. It should probably be working in a published experience.
obrazek

1 Like

This is caused by your client firing the remote rapidly and constantly. It would help if you send the client sided code here so that we can further assist you.

1 Like
elseif XP.Value == 12 then
	Level.Value = 2
	game.ReplicatedStorage.RankInGroup:FireServer(player, 2)

Please provide the full client loop

1 Like

Oh, I just realised the issue is really in the client loop. What should I add for it to fire only once?

while wait() do
	if XP.Value == 0 then
		Level.Value = 0
	elseif XP.Value == 6 then
		Level.Value = 1
		game.ReplicatedStorage.RankInGroup:FireServer(player, 1)
		rankupTextFunction()

Remove it from the while loop, maybe use XP.Changed:Connect(function() instead

1 Like

Yep, thank you. I don’t get any error now, and if I add a print function, it only prints once, when the events gets fired.

However, do you know what might be the issue in player still not getting ranked in the group? Incase you had experience with these systems.

Well, that depends on your code you wrote for the rank bot. It’s not in the hands of Roblox.

Could I send you the scripts so you can look if there is anything that could cause it not actually ranking the player?

Alr, sure. You can DM me whenever you can! Also, I guess you wrote it in Python ?

Alright, thank you! And nope, its in node.js.

Btw, I can’t DM you for some reason.

1 Like