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:
Creating a breakpoint
Make a game function stop at this breakpoint
Then I stop the game so BindToClose won’t run
Is there an easier way to abort a script?
Qin2007
(Qin2007)
November 23, 2021, 8:07pm
2
-- 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.
Forummer
(Forummer)
November 24, 2021, 12:55am
4
game:BindToClose(function()
if condition then
return
elseif othercondition then
--do other code
end
end)
1 Like
Qin2007
(Qin2007)
November 24, 2021, 7:06am
5
did you realy read what i said
i do return not
rogeriodec_games:
wait(3)