Questions about _G

I know that _G is used as like a global variable, and yes I know that exploiters can abuse it what not, I only want to use it like _G.ServerStorage so I don’t have to write local yadadada = yadadada every single time.

But what happens if 2 scripts have different defintions of the same Variable, like

Script 1
_G.welcomeMessage = "Hey"

Script 2
_G.welcomeMessage = "Hello"

Script 3
print(_G.welcomeMessage) -- what prints out????

1 Like

It really depends on where you placed these definitions since you can practically manipulate any variable stored in _G. Most likely, it will print out the value of the welcomeMessage modified in the last script executed.

1 Like

huh? _G is just a global variable, how can exploiters abuse it?

…because its a global variable

_G.deleteEverySinglePlayer = function()

client (exploiter)


so how can an exploiter abuse it…

bro i literally just showed u dude :sob:

It’s a global variable but there is a _G for the client and on the server.

1 Like

Oh. You are thinking that _G on the server will run if the client calls it.

They run independently on client and server.

1 Like

sorry i didnt know that i thought they ran both on server and client

1 Like

Also, it’s probably a good practice to not use _G. I suggest you try using module scripts instead.

1 Like

They used to do this before Filtering was added. Which disables Client-To-Server Replication.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.