Check if all players have a BoolValue enabled

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I want to make it so it will only count certain players with a BoolValue that is set to true.

  2. What is the issue?
    Doesn’t necessarily work and I don’t know why.


    The value is inside all of the players as it’s cloned.

  3. What solutions have you tried so far?
    I’ve tried only check when they’re past the menu but that doesn’t work.
    Any other things on the Developer Hub don’t really lead to my answer.

Script

local replicatedstorage = game:GetService("ReplicatedStorage")
local eventenough = replicatedstorage.EnoughPlayers

local desertvotes = replicatedstorage.DesertVotes.Value
local islandvotes = replicatedstorage.IslandsVotes.Value
local treevotes = replicatedstorage.TreeVotes.Value

local desert = replicatedstorage.Desert
local islands = replicatedstorage.Islands
local tree = replicatedstorage.Tree

local players = game:GetService("Players")

while wait() do
	if #players:GetPlayers() == 1 and players:GetPlayers().GameValues.Lobby.Value == true then
		eventenough:FireAllClients()
		print("Enough Players!")
		wait(25)
		if desertvotes > islandvotes and treevotes then
			desert:Clone().Parent = workspace
		elseif islandvotes > desertvotes and treevotes then
			islands:Clone().Parent = workspace
		elseif treevotes > desertvotes and islandvotes then
			tree:Clone().Parent = workspace
		end
	else
		print("Not enough Players")
		wait(25)
	end
end

It may be a little messy but I think you get the point.

Evidently ‘GameValues’ doesn’t exist.

:GetPlayers() Returns a data table, meaning GameValues does not exist as it doesn’t refer back to the player, you’d have to iterate through the players and check the values that way.

1 Like

ah okay thank you! that makes sense.

1 Like