Need help Optimizing script!

You can write your topic however you want, but you need to answer these questions:
A long time ago i got a script made for my game Kit Hub and i am now revamping it (Because i’m better at developing now and old one is trash). I was thinking about monetization. Because it is a resource game i don’t want to rub it in players/developers who come to get kits. I then thought of a thing where player’s could buy a featured spot for their kits (or any kits) in the server for an hour. I wanted to display it in the front room where everyone would see encouraging player’s to buy it but not rubbing it in.

HOWEVER, i have no flipping idea how.

I have tried looking up my answer and couldn’t find anything.

Please help (I’m willing to pay for the optimized code).
Current Code:

local ASSET_ID = 183435411
local MarketplaceService = game:GetService("MarketplaceService")
local PlayerOwnsAsset = MarketplaceService.PlayerOwnsAsset

script.Parent.MouseClick:Connect(function(player)
	local success, HaveAsset = pcall(PlayerOwnsAsset, MarketplaceService, player, ASSET_ID)
	if HaveAsset then
		print("Have Asset")
	else
			game:GetService("MarketplaceService"):PromptPurchase(player, 183435411)
	end
end)

How do i optimize this?

Optimize in what way? Adding features? Or do you mean making the code more consise?

Sorry, I’m just a bit confused as to what you want exactly.

like making the code different to fit what i need.

So does your code already do what you need it to do?

If not, then I assume you mean you want someone to add those features into the code provided?

Yes that is exactly what i need. The code works for normal prompts but i want a devproduct you have to buy to place it in a certain spot.

try watching this video, it should give you the help you need :slight_smile:

https://www.youtube.com/watch?v=h92s4Xn26oc at 24:38 to the end