Unable to cast value to object error

I am trying to create a script but it keeps showing this same error.
The script is trying to detect if the owner of the game has a t-shirt.
I can find the User ID of the owner but cant check if the owner owns the t-shirt.
Script:

local module = {}

module.FindIfOwn = function()
	local gameOwner = nil
	gameOwner = game.CreatorId
	print(gameOwner)

	local asset = {
		game:GetService('MarketplaceService'):PlayerOwnsAsset(9450208136) -- error here
	}

	if asset then
		print("yes")
	else
		print("no")
	end
end
return module

it should be game:GetService(‘MarketplaceService’):PlayerOwnsAsset(player, 9450208136)
Player is the player that you are checking. Also this may help: MarketplaceService:PlayerOwnsAsset
also, im pretty sure that asset should not be a table, and this should be in a pcall.

How would I go about this? Like what would I have to do to make the value into Player?

Well since this is a module, when you use the FindIfOwn() function, it must be called with a player in the first parameter. Example: module.findIfOwn(game.Players.Lit_skillzYT)
Also, you need to put something when defining the function so it expects a paramater. Example: module.FindIfOwn = function(player)
I hope this makes sense, if it doesn’t then hopefully this will help: Functions

What you are saying makes sense but I am detecting the owner of the game.
would I do module.findIfOwn(game.Players.(name)) if I dont know the name?

using game.Players.Name was just an example of getting a player, you could get the player from Players.PlayerAdded or a touched event.

My problem is I am detetcing the owner of the game and I dont think there is a way to find the owner of the games name to put it in there.

What do you mean by detecting the owner of the game? Are you trying to take the owner of a random game and check if they have the t-shirt?

The owner of the game in studio.
So it would be me in that case because I own the studio project.

if you don’t know the owner, and the owner isn’t in-game, then there may not be a way to check if the owner owns a t-shirt. Are you trying to make a module where people can use it in their games, butonly if they have your shirt?

The reason for this model is that its a way to make a model payed for (in robux), I have seen this done before. There is a way to get the owners id tho. game.CreatorId

well the problem with making it so the model doesn’t run if its not payed for is that anybody can come and take the source code. If you have seen this done securely before, I guess you could copy whateverthey did. Just remember, if a model is public anybody can have the source code regardless of owning the shirt. From there it’s easy to remove the shirt check.

If you require a asset that is a module no-one can use except you it is secure. Ill try to figure this out myself.

Well, good luck! I’m sorry that I wasn’t able to help.
I’d also like to point out that if only you can use it, what’s the point of checking if you own a t-shirt?

Only I can check the script I mean, no-one can view the code in the module.

The only way to make it so nobody can view the source code it to make it private. If it is private, nobody (other than you) can require it.

I belive anyone can require it but no-one can see the code, I know this because I looked at a model from someone who did do this. (not that many people have done this. There are no tutorials or open scource models.)

It is quite simple to find the source code of an asset if you are able to require it. Just type this into your browser: https://www.roblox.com/library/idhere/ and replace idhere with the number you used to require it. If somebody attempts to hide the number by maxing it hexadecimal or binary, you can easily unencrypt it.

Edit: a long time ago it used to be where anybody could require it but nobody could see the code, but that has been changed.

you can make the asset not distributed on the marketplace

If you don’t distribute it then nobody other than you can require it. That is because not distributed means private, and nobody other than the owner can require private modules.