Condition check not working

I have a script that makes a GUI visible depending on whether you meet the requirement.

The issue is that there are 2 different conditions you can meet to have the GUI open, but only one of them works.

The condition that works is if the user owns a game pass.

The script is fired with a remote event by clicking a button.

The remote does fire.

There is no error in the output.

LocalScript (Button):

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Remote")

script.Parent.MouseButton1Down:Connect(function()
	Remote:FireServer()	
end)

ServerScript (Conditions + Open GUI):

local MarketPlaceService = game:GetService("MarketplaceService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Remote = ReplicatedStorage:WaitForChild("Remote")

local GamepassID = 49880806

local function Add(player)
	if player:FindFirstChild("Folder").BoolValue.Value == true or MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)  then
			if player.PlayerGui.GUI.ConditionFrame.Visible == false then
			player.PlayerGui.GUI.ConditionFrame.Visible = true
				game.Workspace.GuiClickSound:Play()

			else

			player.PlayerGui.GUI.ConditionFrame.Visible = false


			end
			
 
	else
		
		if player.PlayerGui.Gui.Frame.Visible == false then
		player.PlayerGui.Gui.Frame.Visible = true

			else

		player.PlayerGui.Gui.Frame.Visible = false


			end
	end
end
Remote.OnServerEvent:Connect(Add)

How do I fix this?

you never assigned the BoolValue’s Value to true

I tried it without the gamepass and the boolvalue set to true and it didn’t work.

you might try the below its abit cleaner. the issue is with the BoolValue its not true do a print of it like below before the if statement

local function Add(player)
print(player:FindFirstChild("Folder").BoolValue.Value)  --- can remove after test
	if player:FindFirstChild("Folder").BoolValue.Value or MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)  then
		player.PlayerGui.GUI.ConditionFrame.Visible = not player.PlayerGui.GUI.ConditionFrame.Visible
		game.Workspace.GuiClickSound:Play()
	else
		player.PlayerGui.Gui.Frame.Visible = not player.PlayerGui.Gui.Frame.Visible 
	end
end

are you setting the boolvalue while on the client or on the server or from local script or from server script?

The BoolValue is set from a datastore script when the player joins.

can you add a print in here?

if player:FindFirstChild("Folder").BoolValue.Value == true or MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamepassID)  then
print("yes")

check it once you load in and see what the value is or do like above add that print in there

it turns out the datastore script was not saving the BoolValue, so I fixed it and everything works now.