Global variable

Hello, I’m trying to set a global variable on a player, and then check if the player has it in another file.
( Setting this variable from a ULX command )

local affected_plys = {}
	for i=1, #target_plys do

		local v = target_plys[ i ]
	--[[ 	if not v:IsValid() then
			if not should_revoke then
				v.vanish = true // This is the variable
				v.vanish = false // This is the variable
			table.insert( affected_plys, v )

And here I try to check if it’s set, however I get nothing:

ply = LocalPlayer()
if ply.vanish == true then

// Stuff here 


Am I doing something wrong? As I don’t really see what’s the mistake.

You are trying to access a serverside variable on the client, send the variable using net message, or take a look at SetNWBool()

The variable on a player will stay in the realm they were set in. If you are setting it serverside and want to access it clientside, you’ll have to network it.

[editline]13th June 2014[/editline]

ninja’d. I recommend against SetNWBool though.

I totally agree with you Bo, I highly discourage using Garry’s NW library.

Ah okay, I had no idea that the variable would stay on the current realm.
I’ll network it over then, thanks :v: