Set true/false var to player that calls certain command.

I want to be able to make sure a player has a true/false var assigned to them but only them. not the server or everyone on the server



function startworking()
	if #player.GetAll() > 1 then 
		if startWork == false then 
			startWork = true
			--else print("You are already working!")
		end

		if startWork == true then

		end
	elseif #player.GetAll() <= 1 then 
		print("Not enough players!")
	end
end


and I figure for stop it would be the same thing in reverse. can someone point me in the right direction? thanks

You’re not assigning that variable to anyone… you’re just changing it if it was false

Also, you don’t need to do the == true check if you’re not using it for anything

[editline]1st March 2016[/editline]

Also, rather than doing var == false you can just do !var

[editline]1st March 2016[/editline]

Also, the ‘elseif’ statement isn’t really needed - you could just use ‘else’

Either use [lua]ply.variable = Whatever[/lua] Or use networked variables (I believe you want a true/false variable so SetNWBool should work)

Remember - Anything that you set on the client, be it LocalPlayer().variable or SetNWBool, will only be set on the client. Anything you want to access through the server and other players must be done through the server