when player touch part, prompt gamepass
i tried this but it does not work
local mps = game:GetService("MarketplaceService") local plr = game.Players.LocalPlayer script.Parent.Touched:Connect(function(h) local hum = h.Parent:FindFirstChild("Humanoid") if hum ~= nil then mps:PromptGamepassPurchase(plr, 8875349) end end
I don't know why you have this in a local script, but this works just fine from a normal script, just search for the players name when it is touched
local mps = game:GetService("MarketplaceService") script.Parent.Touched:Connect(function(h) local hum = h.Parent:FindFirstChild("Humanoid") if hum ~= nil then local plr = game.Players:FindFirstChild(player.Name) mps:PromptGamepassPurchase(plr, 8875349) end end
Make the "P" at "PromptGamePassPurchase" uppercase, yours is lowercase (yours it PromptGamepassPurchase), I also think you didn't close the "Connect" at line 4. There is "end" at the end, but no (
local mps = game:GetService("MarketplaceService") local plr = game.Players.LocalPlayer script.Parent.Touched:Connect(function(h) local hum = h.Parent:FindFirstChild("Humanoid") if hum ~= nil then mps:PromptGamePassPurchase(plr, 8875349) end end)
Honestly I don't know if it will work since my Roblox studio broke, but try it.