You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to kill a function that is running inside of atask.spawn
-
What is the issue? Include screenshots / videos if possible!
i have the following function
task.spawn(function()
while task.wait(options.listenTimer) do
local output = httpService:JSONDecode(httpService:RequestAsync({
['Url'] = options.URL .. '/WorldQL/Ping',
['Method'] ='GET',
['Headers'] = {['key'] = WQLAPIKEY},
}).Body)
if output.failed then
error(output.message)
end
UnreadMessages = output.output.messages
end
end)
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have not tried anything as there appears to be no dedicated function for killing task made with task.spawn or task in general
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
The Task is used for pinging the REST api so it doesen’t mark the client as dead
but after telling the client to disconnect using .disconnect
it still tries to keep alive causing the entire script to crash
Edit:
also note:
I am okay with making a variable called smth like Connected
which can be used to break out of the loop. if that is the reccommended course of action that is fine
Edit2:
link to ROJO project on github
WorldQL_RBXL/src/shared/WorldQL at main · walksanatora/WorldQL_RBXL (github.com)