Script not working

Acknowledgements! I’m Sam, a solo scripter, UI designer and builder. As well as GFX. I am attempting to make a payment center for my game, and I need help with my script which I want it to do this.

  • Send a log of the player
  • Send how much the person, bought via the price;

Current script that I have:

[Server script:]

game.ReplicatedStorage.events.secondaary.OnServerEvent:Connect(function(plr, payment)
	if payment == "FinalPurchase" then
		local Data = {
			['embeds'] = {{ --Add a curly bracket here
				["title"] = "sam's payment notifier",
				["description"] = "hey there matey, you're payment center is going off, ya girl you're rich **cough cough so true**" -- i want to add a field / area where it the administrator to see the price on how much they bought.
			}} --Another closing curly bracket
		}
		Data = httpservice:JSONEncode(Data)
		Marketplaceservice.ProcessReceipt = payment
		httpservice:PostAsync(order, Data)
	end
end)

Basically, the script needs to log, how much they buy and send it to the webhook.

[Local Script]

(manages the purchase and the event)

local MarketplaceService = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer


script.Parent.Parent.PaymentCenter.BackgroundFrame.Background.Lowpoly.SmallL.MouseButton1Up:Connect(function()
	MarketplaceService:PromptProductPurchase(plr, (1151154861))
	wait(7.5)
	script.Parent.Parent.PurchaseScreen.MainFrame.Visible = true
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildtype.Text = "Low Poly"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildsize.Text = "Small"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getpayment.Text = "5,000"
	game.ReplicatedStorage.events.secondaary:FireServer("FinalPurchase")
end)

script.Parent.Parent.PaymentCenter.BackgroundFrame.Background.Lowpoly.MediumL.MouseButton1Up:Connect(function()
	MarketplaceService:PromptProductPurchase(plr, (1151154860))
	wait(7.5)
	script.Parent.Parent.PurchaseScreen.MainFrame.Visible = true
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildtype.Text = "Low Poly"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildsize.Text = "Medium"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getpayment.Text = "10,000"
	game.ReplicatedStorage.events.secondaary:FireServer("FinalPurchase")
end)

script.Parent.Parent.PaymentCenter.BackgroundFrame.Background.Lowpoly.LargeL.MouseButton1Up:Connect(function()
	MarketplaceService:PromptProductPurchase(plr, (1151155019))
	wait(7.5)
	script.Parent.Parent.PurchaseScreen.MainFrame.Visible = true
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildtype.Text = "Low Poly"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildsize.Text = "Large"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getpayment.Text = "15,000"
	game.ReplicatedStorage.events.secondaary:FireServer("FinalPurchase")
end)

script.Parent.Parent.PaymentCenter.BackgroundFrame.Background.HighPoly.SmallH.MouseButton1Up:Connect(function()
	MarketplaceService:PromptProductPurchase(plr, (1151155020))
	wait(7.5)
	script.Parent.Parent.PurchaseScreen.MainFrame.Visible = true
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildtype.Text = "High Poly"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildsize.Text = "Small"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getpayment.Text = "10,000"
	game.ReplicatedStorage.events.secondaary:FireServer("FinalPurchase")
end)

script.Parent.Parent.PaymentCenter.BackgroundFrame.Background.HighPoly.MediumH.MouseButton1Up:Connect(function()
	MarketplaceService:PromptProductPurchase(plr, (1151155021))
	wait(7.5)
	script.Parent.Parent.PurchaseScreen.MainFrame.Visible = true
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildtype.Text = "High Poly"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildsize.Text = "Medium"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getpayment.Text = "15,000"
	game.ReplicatedStorage.events.secondaary:FireServer("FinalPurchase")
end)

script.Parent.Parent.PaymentCenter.BackgroundFrame.Background.HighPoly.LargeH.MouseButton1Up:Connect(function()
	MarketplaceService:PromptProductPurchase(plr, (1151155022))
	wait(7.5)
	script.Parent.Parent.PurchaseScreen.MainFrame.Visible = true
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildtype.Text = "High Poly"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getbuildsize.Text = "Large"
	script.Parent.Parent.PurchaseScreen.MainFrame.OrderDetailsFrame.getpayment.Text = "20,000"
	game.ReplicatedStorage.events.secondaary:FireServer("FinalPurchase")
end)
2 Likes

hey! to add a field in serverScript, you can do something like this: (add this under the description)


game.ReplicatedStorage.events.secondaary.OnServerEvent:Connect(function(plr, payment, Price)
	if payment == "FinalPurchase" then
		local Data = {
			['embeds'] = {{ --Add a curly bracket here
				["title"] = "sam's payment notifier",
				["description"] = "hey there matey, you're payment center is going off, ya girl you're rich **cough cough so true**" -- i want to add a field / area where it the administrator to see the price on how much they bought.
["fields"] = {
				{
					["name"] = "Price",
					["value"] = Price,
					["inline"] = true		
}
			
			}
				

			}} --Another closing curly bracket
		}
		Data = httpservice:JSONEncode(Data)
		Marketplaceservice.ProcessReceipt = payment
		httpservice:PostAsync(order, Data)
	end
end)

and in the local script, you could use marketPlace service to figure out the price of the game pass, and then pass it into server script through the remote event.


local ProductInfo = MarketplaceService:GetProductInfo(1234567, Enum.InfoType.Product)
local Price = ProductInfo.PriceInRobux

game.ReplicatedStorage.events.secondaary:FireServer(plr, payment, Price)

and remove the if statement at the beginning.

hope this helps! make sure to change the GetProductInfo to your gamepass id!

1 Like

So for the local script, do I keep what I currently have, or do I input the one you requested to me earlier, and then just do

Local ProductInfo1 = ProductInfo.PriceInRobux

and repeat that?

you can just insert that in each of the products. you don’t need to use the numbers.