hello, I'm trying to create a gamepass shop using a regular script, but multiple attempts have been made and I can't get it to work. Here is the script:
local tool = game.Lighting:findFirstChild("LinkedRocketLauncher") local button = script.Parent local player = game.Players.LocalPlayer local Value = script.Parent.Gamepass function buy() if button.MouseButton1Click:connect(function() game:GetService("MarketplaceService"):PromptGamePassPurchase(player, Value.Value) local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear end end script.Parent.MouseButton1Down:connect(buy)
please help.
Try this script if it works:
local tool = game.Lighting:findFirstChild("LinkedRocketLauncher") local id = -- your gamepass id local player = game.Players.LocalPlayer script.Parent.MouseButton1Down:Connect(function(buy) game:GetService("MarketplaceService"):PromptGamePassPurchase(player, id) end) local MPS = game:GetService("MarketplaceService") MPS.PromptGamePassPurchaseFinished:Connect(function(plr,id,bought) if id == -- your id and bought then local a = tool:clone() a.Parent = player.Backpack local b = tool:clone() b.Parent = player.StarterGear end end)