I've recently begun looking into Dev products and such so I began looking through free models to look at the scripts and try to learn from their codes. I came across this script and when I tested it out, I couldn't figure out why it wasn't working. Do any of you know why? And how I may fix it?
The concept of the script is to increase the speed of the buyer for 10 seconds. It is placed inside a gui button.
It opens up the prompt for people to buy the Dev Product and it allows for the purchase to take place. Although, for some reason, it does not increase the speed.
productId = 20656568
local MarketplaceService = Game:GetService("MarketplaceService")
function UsernameFromID(ID)
if type(ID) ~= "number" then
return
end
local sets = game:service("InsertService"):GetUserSets(ID)
for k, v in next, sets do
if v.Name == "My Models" then
return v.CreatorName
end
end
end
function giveRewards(player)
player.Humanoid.WalkSpeed = 32
wait(10)
player.Humanoid.WalkSpeed = 16
return Enum.ProductPurcaseDecision.PurchaseGranted
end
MarketplaceService.ProcessReceipt = function(receiptInfo)
giveRewards(receiptInfo.PlayerId)
end
script.Parent.MouseButton1Down:connect(function()
Game:GetService("MarketplaceService"):PromptProductPurchase(script.Parent.Parent.Parent.Parent, productId)
end)
