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?