Transferring variable to another place help

I have been working a feature in a story game that whenever you enter one of those gate like in the games doors or day-care, a variable will keep a hold of how many people entered the gate. Then when you get teleported to the main story, the variable will be transferred to the main game, this is used for counting how many players are in the server, so that I can play specific cutscenes if there are only one person, or an another cutscene only to be seen if there are 2 players in the server. I have made a quick code to test if this works, and when I print the variable (which I named data), it is supposed to print out 1 (because I’m the only one in the server) but instead the output will show null. I do not what I did wrong, can someone please spot any mistakes that I potentially did? Thanks for reading.

The transferring the variable script:

The receiving the variable in the main game script:

if you add it to the datastore, then you can pull it from the datastore after you teleport them in the other place

what do you mean by “pull it from the datastore”?

so create a datastore using the datastore service, then when you teleport the player to the next place, just go into the datastore using the datastore service, and set a variable to the value in the datastore

I just attempted to do what you just said, but it didn’t really work for me. Is either I still do not understand on what you mean or your explanation does not work.

do you know how to use the datastoreservice on roblox?

I do have some understanding, but not like a expert at it

ok just do some research on it, then you’ll be able to apply it to your game

or just use _G but be careful as hackers can see that stuff