Gamepass/ServerScript Help

When any player clicks on the button, it gives all the players the prompt to buy the gamepass, how do I make it so that way only the person who clicks on the button on the SurfaceGUI see’s the prompt.

ServerScript (must be a server script):

Players.PlayerAdded:Connect(function(Player)
		for _, BuyGamepasses in pairs(InformationBoardModule.WaterVehicles) do
			if BuyGamepasses["ButtonJetskiID"] then
				NewInformationBoardGui.WaterVehicles.Buttons.PurchaseJetski.MouseButton1Up:Connect(function()
					MarketplaceService:PromptGamePassPurchase(Player, BuyGamepasses.ButtonJetskiID)
				end)
			end
			if BuyGamepasses["ButtonSpeedboatID"] then
				NewInformationBoardGui.WaterVehicles.Buttons.PurchaseSpeedboat.MouseButton1Up:Connect(function()
					MarketplaceService:PromptGamePassPurchase(Player, BuyGamepasses.ButtonSpeedboatID)
				end)
			end
		end
	end)

If anyone knows how I could solve this lmk

im pretty sure you can send data from the Server -> Client using a RemoteEvent

Example:
Server Script (ServerScriptService)

game.ReplicatedStorage.GPEvent.OnServerEvent:Connect(function(player, GamepassId: number)
local GPS = game:GetService("MarketplaceService") -- thought It was called GamepassService lol

GPS:PromptGamePassPurchase(player, GamepassId)
end)

Local Script:

GUI.Activated:connect(function()
game.ReplicatedStorage.GPEvent:FireServer("Your Gamepass Id")
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.