✓ Accepted answer
I wouldn't recommend using a local script in the server. You should use a RemoteEvent to communicate from the server to client.
Server Script:
local Event = game.ReplicatedStorage.Event
local ClickDetector = game.Workspace.Part.ClickDetector
ClickDetector.MouseClick:Connect(function(p)
Event:FireClient(p)
end)
Local Script:
local MarketplaceService = game:GetService("MarketplaceService")
local ProductID = 16498748
local Event = game.ReplicatedStorage.Event
local Player = game.Players.LocalPlayer
Event.OnClientEvent:Connect(function()
MarketplaceService:PromptGamePassPurchase(Player, ProductID)
end)
Both scripts were fully-tested. No errors or bugs were found.
1 comment
I think you could add a click detector to the SurfaceGUI TextButton?