I'm having a very strange issue with my purchase buttons It works in Studio but not online so I opened up a test server and was getting this error in the output:
14:26:19.487 - BuyItem3 is not a valid member of SurfaceGui 14:26:19.487 - Stack Begin 14:26:19.488 - Script 'Players.Player1.PlayerGui.SurfaceGui.LocalScript', Line 5 14:26:19.488 - Stack End
I thought maybe the Actual button wasn't loading fast enough before the script fired so I added a WaitForChild to make sure everything loaded in first:
local button = script.SurfaceGui local localscript = button:WaitForChild("LocalScript") local buyitems = button:WaitForChild("BuyItem") local buyitems2 = button:WaitForChild("BuyItem2") local buyitems3 = button:WaitForChild("BuyItem3") local buyitems4 = button:WaitForChild("BuyItem4") button.Adornee = script.Parent button.Parent = game.StarterGui
I'm still getting the same error in output.
Here is full script in SurfaceGui:
local button = script.Parent.BuyItem local button2 = script.Parent.BuyItem2 local button3 = script.Parent.BuyItem3 local button4 = script.Parent.BuyItem4 ----------------------------------------------------------------------------------------- local devproductid = 55322787 --$25,000 cash local devproductid2 = 55322496 --$50,000 cash local devproductid3 = 55288351 --$100,000 cash local devproductid4 = 55390484 --$500,000 cash ------------------------------------------------------------------------------------------ button.MouseButton1Click:connect(function() game:GetService('MarketplaceService'):PromptProductPurchase(game.Players.LocalPlayer, devproductid) end) button2.MouseButton1Click:connect(function() game:GetService('MarketplaceService'):PromptProductPurchase(game.Players.LocalPlayer, devproductid2) end) button3.MouseButton1Click:connect(function() game:GetService('MarketplaceService'):PromptProductPurchase(game.Players.LocalPlayer, devproductid3) end) button4.MouseButton1Click:connect(function() game:GetService('MarketplaceService'):PromptProductPurchase(game.Players.LocalPlayer, devproductid4) end)