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.
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
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.
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?
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.
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.