When I do the for loop to print the bought table I don't get anything even though when you click the second time in theory there should be something.

Here is the code

--August 10 2020
--Effects and used to purchase the gun
--
--Made by:Mikey2019d

---------------
-- Constants --
---------------
local GunSelected = script.Parent.Parent.ViewportFrame
local currentLable = script.Parent
local hoverLableText = script.Parent.Parent.purchase.TextButton
local cont = script.Parent.Parent.purchase
local hoverEffect = script.Parent.Parent.AreaCovpurchase
Active = false
Bool = false
----------
-- Effect script --
----------
currentLable.MouseEnter:Connect(function()
	Active = true
	Bool = true	
	currentLable.Visible = false
	hoverEffect.Visible = true
	cont.Visible = true	
	game.Players.LocalPlayer.PlayerGui.Select:Play()
end)

-----------------
-- Main script --
-----------------

hoverLableText.MouseButton1Click:Connect(function()
	local vp = script.Parent.Parent.ViewportFrame:GetChildren()[1]
	game.Players.LocalPlayer.PlayerGui.Select:Play()
	local bought = {}
	local functions = require(game.ReplicatedStorage.ModuleScript)
	local inList = functions.Map(bought,vp.Name)
	for i=1,#bought,1 do
		print(bought[i])
	end
	print(inList)
	local PurchasePending = game.ReplicatedStorage.PurchasingTransaction:InvokeServer(vp.Name)
	if PurchasePending[1] == true then
		local purchasedWeapon = game.ReplicatedStorage.Purchases:WaitForChild(PurchasePending[2])
		table.insert(bought,vp.Name)	
	end
end)
	hoverLableText.MouseLeave:Connect(function()	
	currentLable.Visible = true
	hoverEffect.Visible = false
	cont.Visible = false	
end)	

Thanks for the help.

3 comments

1

Did you try putting a print right after updating the table? (aka right after table.insert())

0

It probably means PurchasePending[1] is false

0

@Mroczusek yea your right the computer reads top to bottom if i update from the top it is giving me the right one. Thanks