Is there an easy way to abort the game in Studio?

My game uses DataStore and it saves data when the game ends (BindToClose).
Sometimes, during debugging, I want to just abort the script, to NOT save the data, on purpose.
Currently, the only way I can abort a script without running BindToClose is:

  1. Creating a breakpoint
  2. Make a game function stop at this breakpoint
  3. Then I stop the game so BindToClose won’t run

Is there an easier way to abort a script?

 -- if the current session is studio, do nothing
    if RunService:IsStudio() then
        return
    end

because of return everything after does not run
https://developer.roblox.com/en-us/api-reference/function/DataModel/BindToClose

Thanks, but unfortunately, due to a Studio bug that doesn’t save data correctly when ending the game, I have to use this in BindToClose:

game:BindToClose(function()
	if RunService:IsRunning() and RunService:IsStudio() then
		wait(3)
	end
end)

However, my question is if there is any simpler way to abort a script while running in Studio, without having to use breakpoints.

game:BindToClose(function()
	if condition then
		return
	elseif othercondition then
		--do other code
	end
end)
1 Like

did you realy read what i said

i do return not