for i,v in ipairs(script.Parent:GetChildren()) do
	if v:IsA("TextButton") then
		v:FindFirstChild("TextButton").MouseButton1Click:connect(function()
			if v.Name == "TenKCash" then
			MarketplaceService:PromptProductPurchase(Player,TenKCash)
			elseif v.Name == "TwentyFiveKCash" then
			MarketplaceService:PromptProductPurchase(Player,TwentyFiveKCash)
			elseif v.Name == "OneHundredKCash" then
			MarketplaceService:PromptProductPurchase(Player,OneHundredKCash)
			elseif v.Name == "TenSpeed" then
			MarketplaceService:PromptProductPurchase(Player,TenSpeed)
			elseif v.Name == "TwentyFiveHealth" then
			MarketplaceService:PromptProductPurchase(Player,TwentyFiveHealth)
			elseif v.Name == "GravityCoil" then
			MarketplaceService:PromptProductPurchase(Player,GravityCoil)
			elseif v.Name == "Jetpack" then
			MarketplaceService:PromptProductPurchase(Player,Jetpack)
			end
		end)
	end
end

It is a LocalScript

I only posted the function, everything is defined though & it has been doublechecked.

The purpose of this script is that when a player clicks a TextButton, it prompts them a purchase for the developer product. It works fine & dandy in Studio, but not in-game.

Please note that this isn't the problem, it's just the way the GUI is designed;

v:FindFirstChild("TextButton").MouseButton1Click:connect(function()

3 comments

2

That's odd. Line 2 looks suspicious. Have you tried your code without that?

0

No, I haven't. If I were to remove it then it would break because there's also a TextLabel in the frame. I'll temporarily remove the TextLabel I suppose & try it.

0

It works! Thank you a lot, I really do appreciate it.