I want to get all the "InDungeon" bool value which is located in every player, and I'm trying to set Value to true if one of the "InDungeon" value is true, and set Value to false if every "InDungeon" value is false

while wait() do
for i,v in pairs(game.Players:GetDescendants()) do
    if v.Name == "InDungeon" then
        if v.Value == false then
            script.Parent.Value.Value = false
            print(v.Value)
        else
            script.Parent.Value.Value = true
        end
    end
end
end

4 comments

0

You could do if v:IsA("BoolValue").

0

and what would that change?

0

It just checks if the chosen object is a certain class

0

right that doesn't really do anything but breaks it because I have other bool values inside of player as well. I found another way to approach my objective so this isn't really needed