How to change original variable values while debugging a script?

If I am debugging a script and I create a breakpoint in one line, when the script stops at this breakpoint, would it be possible to MANUALLY change the value of an internal variable, for testing purposes?

local a = 1
print(a) --< breakpoint here

In the above case, I set a breakpoint at line 2; when the script stops at line 2, the value of a will be 1.

So at this point, I want to change the value of a to 999 manually.

That done, when I resume, the value of print(a) would now be 999 and no longer 1.
Is this possible?

2 Possible ways,

- First way

Disable the script then edit the variable,
click on the reload script button on Script tab then enable the script.

- Second way

Create a number value or attribute and type the following code:

local a = script:GetAttribute("debug") and script:GetAttribute("debug") or "attribute does not exists."

Change the attribute however you want.

Thanks, but:

It doesn’t seem to be working.
Have you tested before?
If I disable the script and I try to change anything within it, I get:

Exception while populating global variables window: Cannot perform this operation unless the thread is paused

This implies having pre-code inside the script before debugging. This wouldn’t work in a real case where debugging could happen on any line.

You are using global variables? (_G)

Can you reproduce your suggestion with the above script?

Okay, let me record a video and send it here.

Thanks, but at least the first suggestion appears quite different to me, with the error I mentioned:

Maybe bc you are debugging from the print line not from your variable line?

In this case, the error is the same.
Anyway, my question is so that I can manually change a pre-existing script variable value, starting from the breakpoint, AND BE ABLE TO CONTINUE from that breakpoint, without interrupting the script flow.

I don’t think thats possible then, you have to stop the script at some point to run the new code. (Either by disabling it or reloading it)

The only way is using Values or Attributes in loops.