I need to stop a thread. I don't really have anything more to add other than that.
A thread is a method that allows you to run multiple lines of code at once when a particular code yields. You don't cancel a thread. If you're using a loop inside of a thread, you can use break
to stop the loop. As @INot_here said.
local stop --Create stop variable with nil value coroutine.resume(coroutine.create(function() --Create an anonymous thread and resume it. while true do game:GetService("RunService").Heartbeat:Wait() if stop then break end --If stop variable is true then stop the loop! print("I will forever run, nothing will stop me!") end end)) wait(5) stop = true --Let's stop the unnecessary loop now!