How would I make a variable for the player in a Script?

I want to make an if statement that looks like this:

if Player.Variable = false then --the variable is a boolvalue stored inside the player
--code
end

for example the variable for a player in a localscript would be:
game.Players.LocalPlayer
But I have no clue how to make a variable for the player in the script

NOTE: it is a script not a localscript

1 Like

you need some kind of interaction to know the player’s name.

What exactly triggers your code?

1 Like

You would just get the player, get the value and then from the value to .Value to get the value of it.

Also like what @Super_pro322222 said you need some type of event that will run your code and get the player.

Example Code:

game.Players.PlayerAdded:Connect(function(plr)
	local Value = plr.ValueName.Value
	if Value == false then
		print("Run code here!")
	end
end)
2 Likes