If you fixed it for me, then you can just either message me the solution on roblox (recommended) or here.
Fix my script please:
I put it to local script btw
local player = game.Players.LocalPlayer
local id = 4856087
script.Parent.MouseButton1Down:connect(function()
game:GetService("MarketplaceService"):PromptPurchase(player, id)
end)

3 comments
if you want to buy a gamepass do "MarketplaceService:PromptGamePassPurchase(player, id)"
^ also
:connect()is deprecated, use:Connect()Don't come on this site asking for us to fix the code for you.