Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to fix no variables in the "watch" tab and global variables cant be used in other scripts?

Basically I want to use variables but its not easy because global variables dont work on all scripts only on the one it originated from.

--Script 1
_G.thing = "ball"
print(_G.thing)
--Output is "ball"

--Script 2
wait(1)
print(_G.thing)
--Output is "nil"

And in the "watch" tab no variables show up, none, not even local variables.

Image: http://cdn.discordapp.com/attachments/678245054451810304/1055115233464692766/image.png

if anyone knows how to fix these 2 problems please tell me, ive been trying to fix them for a while now, but roblox dev forum wont let me talk in there.

1 answer

I fixed it.

For the variables to show up in the Watch tab, I forgot to set a breakpoint.

And for the global variables, I called the variable wrong instead of _G.variable; I called it just variable.

For me, it took a few days to find the solutions to this; if anyone is having the same problem, feel free to use this.

This discussion is preserved as it was. New answers, comments, and votes are closed.