#It took me a while to code a solution since I'm not quite good at this, but I got your solution.
Issues:
1: It's not printing because it's a Local Script
2: You have to define a player with the variable plr
Solution:
You need to script it inside the part you want to be the trigger of the Prompt, if you do it like a Local Script it will only trigger for the part but not other clients.
Now that you did that, all you have to do is just define who is the player, which is any parent that has the name of a player in Players.
local gamepass = 33857923
local part = script.Parent
local characters = game:GetService("Workspace")
local players = game:GetService("Players")
cooldown=false
part.Touched:Connect(function(touching)
if not cooldown then cooldown=true
if touching:IsA("Part") or touching:IsA("MeshPart") then
for i,player in pairs(players:GetChildren()) do
if player.Name == touching.parent.name then
print("Success || PLR:"..player.Name)
game:GetService('MarketplaceService'):PromptGamePassPurchase(player, gamepass)
wait(5)
cooldown=false
end
end
end
end
end)
Hope it helps, I tried my best lol!