Code not working

local mps = game:GetService(“MarketplaceService”)

local gamepass_id = 9176602
local toolID = “GRAVITYCOIL”

script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
mps:PromptGamePassPurchase(player, gamepass_id)
end)

mps.PromptGamePassPurchaseFinished:Connect(function(player, id, purchased)
if id == gamepass_id and purchased then
local tool = game.ServerStorage:WaitForChild(toolID):Clone()
tool.Parent = player.Backpack
player.CharacterAdded:Connect(function()
tool.Parent = player.Backpack
end)
end
end)

This is a local script inside a GUI so can u please tell me why this isn’t giving the tool

It looks like you are trying to do this all client side. This isn’t allowed for a reason; hackers could give themselves any tools they want. Instead, only do the prompting client side and have the rest running in a Script inside ServerScriptService with a ProcessReceipt function. Hope this helps!

1 Like