Does this script enable the gui when the player owns both gamepasses or one of them?

Hello so i got this short script right here and it works but i was wondering if it enables the gui if the player owns both gamepasses or does it enable the gui if the player owns one of the gamepasses:

local player = game.Players.LocalPlayer
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 766887852, 768155407) then
	script.Parent.Parent.Enabled = true
else
	script.Parent.Parent.Enabled = false
end

UserOwnsGamepassAsync only has two arguments that you should be using
UserId, and GamepassId.

You should be doing something like:

local player = game.Players.LocalPlayer
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 766887852) and game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, 768155407) then
	script.Parent.Parent.Enabled = true
else
	script.Parent.Parent.Enabled = false
end

the ‘and’ in the middle will help the code to understand that it says ‘if user owns this gamepass AND owns this gamepass, then do this!’

If you’d prefer the GUI to only enable when the user has just ONE of the games, you can replace the ‘and’ with ‘or’.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.