What do you want to achieve?
I want to make a script that checks if the game owner has purchased the product and it is not shared with anyone else. If the game owner doesn’t have the product purchased it gets deleted in the workspace/server script service.
What is the issue?
I can’t find any way how to make it.
What solutions have you tried so far?
I have tried to search it on the developer hub and the whole internet but didn’t find.
If you could provide me with any information or help me to find the solution I would appreciate it, many thanks!
I would use MarketplaceServer:UserOwnsGamePassAsync which returns a bool. Then you would check if the function returned true (owns) or false (does not own), and if it is false then you would proceed to delete your product from their game.
local MarketPlace = game:GetService("MarketplaceService")
local gameowner = game.CreatorId
if MarketPlace:UserOwnsGamePassAsync(gameowner,10163160) then
else game.Workspace.Model1:Destroy()
end
You could just use the notoperator and remove the else.
local MarketPlace = game:GetService("MarketplaceService")
local gameowner = game.CreatorId
if not MarketPlace:UserOwnsGamePassAsync(gameowner,10163160) then
game.Workspace.Model1:Destroy()
end
The not operator inverts the condition. So that means true is false and false is true. Sorry if I am confusing you, but either way works.