It is already Local script
local MarketplaceService = Game:GetService("MarketplaceService") local buyButton = game.Workspace.BuyButton.SurfaceGui.TextButton local productId = 21248921 buyButton.MouseButton1Click:connect(function() MarketplaceService:PromptProductPurchase(player, productId) end)
player
is not a globally defined variable in the default environment; you have to access the client's player using game.Players.LocalPlayer