so, i have a script to buy a color for my sword, but the problem is, when you buy it, it doesnt give you the color and just take your robux. here the code
local MarketplaceService = game:GetService("MarketplaceService")
MarketplaceService.ProcessReceipt = function(purchaseInfo)
local player = game:getService("Players"):GetPlayerByUserId(purchaseInfo.PlayerId)
if purchaseInfo.ProductId == 974191894 then
local TakeNumber = {7,6,5,4,3,2,1}
local ColorPicked = math.random(1, #TakeNumber)
local save = player:WaitForChild("ColorsSave"):WaitForChild("Colors"):WaitForChild("Color")
if ColorPicked == 7 then
save.Value = 7
player.Character.Sword.Sword.Katana.MeshPart3.BrickColor = BrickColor.new("Black")
elseif ColorPicked == 6 then
save.Value = 6
player.Character.Sword.Sword.Katana.MeshPart3.BrickColor = BrickColor.new("Light stone grey")
elseif ColorPicked == 5 then
save.Value = 5
player.Character.Sword.Sword.Katana.MeshPart3.BrickColor = BrickColor.new("Lily white")
elseif ColorPicked == 4 then
save.Value = 4
player.Character.Sword.Sword.Katana.MeshPart3.BrickColor = BrickColor.new("Mid gray")
elseif ColorPicked == 3 then
save.Value = 3
player.Character.Sword.Sword.Katana.MeshPart3.BrickColor = BrickColor.new("Hurricane grey")
elseif ColorPicked == 2 then
save.Value = 2
player.Character.Sword.Sword.Katana.MeshPart3.BrickColor = BrickColor.new("Cloudy grey")
elseif ColorPicked == 1 then
save.Value = 1
player.Character.Sword.Sword.Katana.MeshPart3.BrickColor = BrickColor.new("Really black")
end
return Enum.ProductPurchaseDecision.PurchaseGranted
end
end
