Products is not a valid member of ModuleScript "Workspace.MainModule"

This error is occurring within a donation board. I’m not too sure how I’d solve this but here’s the script if anyone wants take a look at it.

repeat wait() until _G.DBLocked ~= nil

if _G.DBLocked == true then
	script:Destroy()
	return
end

local Products = require(script.Parent.Parent.Products).Products

function updateBoard(data)
	for _,v in pairs (script.Parent.SurfaceGui.MainFrame.ScrollingFrame:GetChildren()) do
		v:TweenPosition(UDim2.new(-1,0,0,v.Position.Y.Offset),'In','Quad',1,true)
		wait()
		delay(1,function()
			v:Destroy()
		end)
	end
	local n = 0
	for k, v in pairs(data) do
		local L = script.Frame:Clone()
		L.Parent = script.Parent.SurfaceGui.MainFrame.ScrollingFrame
		L.Title.Text = "Donate "..v.ProductPrice.." Robux"
		L.Id.Value = v.ProductId
		L.Position = UDim2.new(1,0,0,(n* 20) + (n*5))
		L:TweenPosition(UDim2.new(0,0,0,(n* 20) + (n*5)),'In','Quad',1,true)	
		n = n + 1
		script.Parent.SurfaceGui.MainFrame.ScrollingFrame.CanvasSize = UDim2.new(0,0,0,(n * 20) + (n*5))
		wait()
	end	
end

updateBoard(Products)
3 Likes

Can you show the Module Script?

1 Like
--[[
	This used to prevent people from copying this in studio, however now it's open source it's redundant.
	~Nitefal
--]]

local children = script:GetChildren()
script = Instance.new("ModuleScript")
for _, child in pairs(children) do
	child.Parent = script
end

local script = script do
    getfenv()['script'] = nil
end

local UIATUS = 0
spawn(function()
	while true do wait()
		script.Archivable = false
	end
end)

if game.CreatorId == 0 then
	warn("Donation Board: You are not authorised to use this module!")
	script:Destroy()
else
	UIATUS = 2
end

local module = {}
module.LoadAssets = function()
	if UIATUS == 2 then
		if game.Workspace:FindFirstChild("Boards") then
			game.Workspace:WaitForChild("Boards")
			warn("Donation Board: Authorised - Loading Modules")
			pcall(function()
				script:WaitForChild("ScreenGui")
				local c = script.ScreenGui:Clone()
				c.Parent = game.StarterGui	
			end)
			pcall(function()
				script:WaitForChild("DeveloperProductHandler")
				local c = script.DeveloperProductHandler:clone()
				c.Parent = game.Workspace.Boards
				delay(1,function()
					c.Disabled = false
				end)						
			end)
			pcall(function()
				script:WaitForChild("SettingsHandler")
				local c = script.SettingsHandler:clone()
				c.Parent = game.Workspace.Boards
				delay(1,function()
					c.Disabled = false
				end)						
			end)		
			pcall(function()
				for _,b in pairs (game.Workspace.Boards:GetChildren()) do
					if b.Name == "Screen" then
						for _,v in pairs (script.Board:GetChildren()) do
							local C = v:Clone()
							C.Parent = b
							if C.Name == "ScoreUpdater" then
								delay(1,function()
									C.Disabled = false
								end)
							end
						end					
					end
				end			
			end)
			pcall(function()
				for _,b in pairs (game.Workspace.Boards:GetChildren()) do
					if b.Name == "Buttons" then
						for _,v in pairs (script.Buttons:GetChildren()) do
							local C = v:Clone()
							C.Parent = b
							if C.Name == "Updater" then
								delay(1,function()
									C.Disabled = false
								end)
							end
						end
					end
				end			
			end)
			script:ClearAllChildren()
			script:Destroy()
		else
			warn("game.Workspace.Boards - Not Found!")
			script:ClearAllChildren()
			script:Destroy()
		end
	end
end
module.LoadAssets()
return module
1 Like

Well, that is the issue. The module is not returning Products. Did you modify the module and remove it?

1 Like

No I did not modify the script.

3 Likes

Ok. In your module, under where it says local module = {} you need to add the following:

module.Products = {
    {
        ProductId = 100000,
        ProductPrice = 2
    },
} -- obviously fill in your developer products and prices
2 Likes

I already have that in a different script.

1 Like

The module script you sent me is named Products, right?

1 Like

No you were asking for the module script, so I gave you that. The module script is called MainModule.

1 Like

This is referring to a module script named Products. Can you send me that please?

1 Like
local module = {}	
module.Products = {
	
	{
		ProductPrice = 5, --The price from the Developer Product.
		ProductId = 1087885946 -- The ID from the Developer Product.	
	},
	{
		ProductPrice = 10, --The price from the Developer Product.
		ProductId = 1087886052 -- The ID from the Developer Product.	
	},
	{
		ProductPrice = 50, --The price from the Developer Product.
		ProductId = 1087886595 -- The ID from the Developer Product.	
	},
	{
		ProductPrice = 100, --The price from the Developer Product.
		ProductId = 1087886637 -- The ID from the Developer Product.	
	},
	{
		ProductPrice = 1000, --The price from the Developer Product.
		ProductId = 1087887739 -- The ID from the Developer Product.
	},
	
}

--module.AbortCustomPurchases = true --READ Below for what this does. 

return module

Can you send me a screenshot of where this module script is and where the script you sent is?

I think your issue may be that the Module Script needs to be named Products

Now where is the script that you put in your original post?

It’s called Updated, see my recent post above to see where it is.

Is the model Boards a member of MainModule?

Yes boards is a member of MainModule.

Alright, so this is what you need to do:

You need to replace this line:

With this:

local Products = require(script.Parent.Parent.Boards.Products).Products
2 Likes

Yes, in fact we both figured it out at the same time. Just noticed that as soon as you posted it lol, thanks for your help!

1 Like