local MarketplaceService = game:GetService("MarketplaceService")
local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local GameDataModule = require(ReplicatedStorage:WaitForChild("Modules").GameDataModule)
game.Workspace.Part.SurfaceGui.TextButton.Activated:Connect(function()
print("test")
MarketplaceService:PromptGamePassPurchase(LocalPlayer, GameDataModule.Gamepass_Premium)
end)
Send screenshot of all the instances (Show the part and all its descendants, the part, surfacegui, and the textbutton)
If you are on Windows use the snip tool or get it from the Microsoft store
Move the Surface Gui Inside The LocalScript
Next, In Your LocalScript In StarterPlayerScripts,
local MarketplaceService=game:GetService('MarketplaceService')
local Part=workspace.Part -- The Part in Workspace
local Player=game.Players.LocalPlayer
local PlayerGui=Player:WaitForChild('PlayerGui')
local SurfaceGui=script:WaitForChild('SurfaceGui') -- The Surface Gui Inside the LocalScript
local GamepassID=49631462-- Gamepass ID
SurfaceGui.Adornee=Part
SurfaceGui.TextButton.MouseButton1Up:Connect(function()
print("Test")
MarketplaceService:PromptGamePassPurchase(Player,GamepassID)
end)