Returns will make the code more expressive but it isn’t necessarily required. When the function ends it returns nil if you didn’t manually return anything.
Edit: I thought you meant at the end of the function, apologies!
Returns will make the code more expressive but it isn’t necessarily required. When the function ends it returns nil if you didn’t manually return anything.
Edit: I thought you meant at the end of the function, apologies!
Each server holds only 1 player.
All you have to do is remove the wait lines and it should work just fine.
Tried this and it did not work.
I tried removing the waits but it still didn’t work.
I need more information, were there any console errors? What happened
There are no errors, game:BindToClose() is just not firing at all.
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.
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.
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.