I have these 2 scripts inside a Text Button inside a Surface Gui inside a brick. The Developer Product is to give 20 extra speed intill you die but the gui to buy the Dev Product does not come up.
Script #1: DevProductMain
local developerProduct = 20702452 -- Id of the developer product
local speedInc = 20 --Change this to the amount of Walkspeed you'd like to give.
Game:GetService("MarketplaceService").ProcessReceipt = function(receipt)
if receipt.ProductId == developerProduct then -- the speed dev product
for i,v in pairs(game.Players:GetPlayers()) do -- loop through the players
if v.userId == receipt.PlayerId then -- if they're the player that bought it
if v.Character and v.Character:FindFirstChild("Humanoid") then
v.Character.Humanoid.WalkSpeed = v.Character.Humanoid.WalkSpeed + 20 -- add speedinc to their current walkspeed
end
end
end
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
and Script #2: MainScript
local marketplaceService = game:GetService("MarketplaceService")
local developerProduct = "http://www.roblox.com/Item-Link-item?id=20702452" -- Item link to the developer product, you must use the WHOLE Link, not just the ID.
local walkspeedButton = script.Parent.BuyWalkspeed
local player = script.Parent.Parent.Parent
function getItemId(developerProduct)
if tonumber(developerProduct) then
return tonumber(developerProduct)
elseif developerProduct:find("id=") then
a,b = developerProduct:find("id=")
return tonumber(developerProduct:sub(b+1))
end
end
devId = getItemId(developerProduct)
function buyDevProduct()
marketplaceService:PromptProductPurchase(player, devId)
end
walkspeedButton.MouseButton1Down:connect(buyDevProduct)

1 comment
To anyone wondering the whole thing is in Workspace