Hello. I was attempting to rescript a gear purchaser.
However, it doesn’t work.
Script:
local ToolName = {"RocketLauncher"}
local Storage = game.ServerStorage
local Part = script.Parent.Parent
local ProximityPrompt = script.Parent
local gamepassId = 12616758
local MarketPlaceService = game:GetService("MarketplaceService")
ProximityPrompt.Triggered:Connect(function(Player)
MarketPlaceService:PromptGamePassPurchase(Player, gamepassId)
end)
local success, errormessage = pcall(function()
MarketPlaceService.PromptPurchaseFinished:Connect(function(player, gamepassId, isPurchased)
if isPurchased == true then
if player and player.Character then
local Backpack = player:WaitForChild("Backpack")
for i = 1, #ToolName do
local Tool = Storage:FindFirstChild(ToolName[i])
if Tool then
Tool:clone().Parent = Backpack
end
end
end
end
end)
end)
if not success then
print("failed, error:", errormessage)
end
It gave no outputs also.