BindToClose just.. not working?

i tried to use BindToClose for once but it just didn’t work
what’s wrong with my code thats cusing it to shutdown instantly?? i even tried to yield. i’m so confused

game:BindToClose(function()
				local attempt2 = ds.GetAsync({
					DataStore = datastore,
					Key = "MainServerQueue"
				})
				if attempt2 ~= nil then
					attempt2 = game:GetService("HttpService"):JSONEncode(attempt2)
					for i, entry in pairs(attempt2) do
						if entry.JobId == game.JobId then
							table.remove(attempt2, i)
							ds.SetAsync({
								DataStore = datastore,
								Key = "MainServerQueue",
								Value = game:GetService("HttpService"):JSONEncode(attempt2)
							})
							if require(script.Parent.Parent.Config).LogPrints == true then
								print("🏔️ | 📜 | Server removed from SECRET PROJECT REDACTED FROM DEVFORUM server list!")
							end
							break
						end
					end
				end
				task.wait(3)
			end)
1 Like

nevermind i’m dumb i was attempting to iterate over json encoded strings

1 Like

funniest post of the day

1 Like

i can understand why you think that :sob:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.