Does this script have any porblems?

I don’t know if this has any problems with it:

local gamePassID = 16268626
local userId = game.CreatorId

if game.CreatorType == "User" then
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(game.CreatorId,gamePassID) then
		print("They DO have it")
	else
		print("THEY DONT have it")
		script.Parent:Destroy()
	end
else
	local group = game:GetService("GroupService"):GetGroupInfoAsync(game.CreatorId,)
	local owner = group.owner
	local ownerID = owner.Id
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(ownerID,gamePassID) then
		print("They DO have it")
	else
		print("TRHEY DONT")
		script.Parent:Destroy()
	end

You need to use an EnumItem, not a string

1 Like

A few issues that I see

  1. You have to give it the Enum for the CreatorType unless you specify you want to compare the name
  2. You have an extra comma in GetGroupInfoAsync, and the owner key in the group info is Owner, not owner
  3. There’s a missing end

I think this should be the version you should use

local gamePassID = 16268626
local userId = game.CreatorId

if game.CreatorType == Enum.CreatorType.User then
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(userid,gamePassID) then
		print("They DO have it")
	else
		print("THEY DONT have it")
		script.Parent:Destroy()
	end
else
	local group = game:GetService("GroupService"):GetGroupInfoAsync(game.CreatorId)
	local owner = group.Owner
	local ownerID = owner.Id
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(ownerID,gamePassID) then
		print("They DO have it")
	else
		print("TRHEY DONT")
		script.Parent:Destroy()
	end
end
1 Like