So today i decided to make a Level Pass Checker, For Example, Checks if player is attempting to join a new level, when another level already started, Im trying to make a Checker, using for i,v in pairs, by checking BoolValues i have saved in the Player Folder. When a player Starts a Level, The Values turn into true.
for _, GetLevelValues in pairs(ClientLevelFolder:GetChildren()) do
if GetLevelValues:IsA('BoolValue') then
-- Compare if CheckValueTrue == true then, Compare with part it touched.
if GetLevelValues.Value == true then
self.ActiveLevel = GetLevelValues
if self.ActiveLevel.Name == tostring(PortalLevel) then
print('{Client}: Attempted to Join active level, Passed!')
else
print('{Client}: Attempted to Join Different level, Failed!')
end
else
if self.ActiveLevel ~= nil then return end -- If No Active Level Found
self.FireRemote()
end
end
end
from what i understand, The code is detecting the other values in the folder, which are false, which are triggering the, IF Values false behavior. Any workaround this?
I Explained it perfectly, I said im making a Level Requirements system, Which checks the current active levels from a BoolValue folder i have, The requirement is checking, If another level value is true, and if player is trying to start a new level, when another level is active, Im achieving this by turning the BoolValues true when Client starts level
Example: Player Starts Level. Level1.Value = true
Player Attemps to Join Another Level, Requirements Check this
Example
for i,v in pairs(level) do
if v.Value == true then
if v.Name == LevelTryingToStart then
fire remote
else
dont fire remote
end
end
end
…
Since its for i,v in pairs, is looping through my folder, The False Requirement behavior Also fires, since its also looping through values that are FALSE… Maybe look at the code …
I need a work around the code, Since , its still firing the IF NO ACTIVE LEVEL FOUND Behavior, When level was found, which it isn’t supposed to fire, what i know is, its detecting the False values of the other values of the folder. which is why this is Happening, Need a workaround this.
I have the values, Manually enabled to test them. So yes, Nothing has to do with that, Again, do you not understand how For i,v in pairs work?, For i,v in pairs, Loops through all the values. Even if i find the True Value, The False Behavior still runs, Because for i,v in pairs has found the false value