Can someone help me with private modules?
I have this script right here:
local wat = 678054912
local market = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect (function()
script.Parent=game.ServerScriptService
local market=game:GetService("MarketplaceService")
for i,v in pairs(game.Players:GetChildren()) do
if not market:PlayerOwnsAsset(v,wat) then
market:PromptPurchase(v,wat)
end
end
end)
But I want it to be a private module where the user only needs to do this:
local PRODUCT_ID = 678054912
require((2985042) (PRODUCT_ID)
I have done this with the MainModule:
local module = function(PRODUCT_ID)
local Product = Instance.new("NumberValue")
Product.Name = "GamepassProduct"
Product.Value = PRODUCT_ID
Product.Parent = game.ServerScriptService
script.Popup.Parent = game.ServerScriptService
end
The main script of the popup that I put in the MainModel:
local wat = GamepassProduct.Value
local market = game:GetService("MarketplaceService")
game.Players.PlayerAdded:Connect (function()
script.Parent=game.ServerScriptService
local market=game:GetService("MarketplaceService")
for i,v in pairs(game.Players:GetChildren()) do
if not market:PlayerOwnsAsset(v,wat) then
market:PromptPurchase(v,wat)
end
end
end)
Someone help i've been on this for a couple hours.
Also the main script makes it so whenever a player joins the server, it will auto popup an item.

1 comment
Didn't work.