game:BindToClose() is not working?

Actually i think i figured out one possible reason. Try going to the url you set directly and show what you see or tell me what happens. Does it take long to load? Etc… Glitch puts projects to sleep on the free tier

(Edit: terrible grammar fix)

I know they put projects to sleep, that is why i am using game:BindToClose(). game:BindToClose() should give the glitch bot an extra 30 seconds to wake up before the server shuts down.

That is not guaranteed. You say it should but the question is if it does, i have had glitch projects before that have refused to start at all sometimes. Glitch is free, that is an advantage and a disadvantage, you get free hosting but it isnt 100% reliable, that is the cost.

Personally i would never use a free glitch project in a live production game if it had a time limit (like 30 seconds to start) because it is not guaranteed that it will start in time.

What is the purpose of the glitch app? What does it do, anything expensive? The more information available to people the easier this will be to figure out, because i don’t think it has to do with your roblox code.

Edit: If the http request takes more than 30 seconds, roblox will shut the server down whether or not it was completed. If the glitch app doesn’t start in time it will cancel

You should move your wait(30) lower or quite simply, get rid of it and follow saving async. Otherwise, it’s going to run on one player wait 30 seconds, and then forcefully close before it even gets to the next player.

There is only 1 player per server, so that wouldn’t be the problem.

1 Like

It would be because it is inside BindToClose, which automatically terminates the server regardless of if it completes. After 30 seconds the game is closed and all functions will be stopped, so that doesn’t work.

(If you didn’t know, wait is incredibly unreliable!)

The glitch app usually starts within 5-10 seconds.

Instead of relying on print on BindToClose, maybe consider sending a webhook to Discord on the BindToClose? Roblox could be killing the ability for the /devconsole to receive print events on processing a shutdown.

Adding the wait is simply my way of making BindToClose keep the server open for its maximum period (30 seconds).

Read all the replies. They make a request to glitch to rank someone, not to discord.

Well the print gets fired after the player gets kicked and it shows in the dev console so…

But that is unnecessary, there is no reason to keep the server open if the request has completed. The http request yields.

Maybe try to wake up the server (make req to base url not to ranker) every 5 minutes starting from when player joins or something like that to ensure it’s ready to use when they finish.

It’s not possible or favorable to keep waking a glitch bot up as it will self terminate and won’t listen until an actual web browser interacts with it.

It’s highly suggested to either pay for Glitch Pro for 24/7 running of your apps or use an alternative service as Glitch’s Policy on ‘keeping a full-stack app awake on a free plan’ isn’t allowed anymore.

Well I don’t think there are any free alternatives-

What’s the intent of using glitch?

Saving data? Firestore Realtime database works.
Processing data? Google Scripts is free.

You could try https://replit.com. It’s very similar to glitch and allows uptime robots.

I’m using it to rank players in a group after they pass an application in-game.

Are there any tutorials for how to rank players in a group from in-game using repl.it?

I would probably suggest instead of kicking a player, keep the player ingame and have the server ping the glitch app over and over until it is successful, then to kick the player after it has ran.