Hi, I’m making a coin devproduct and It is not giving me the coins
local script:
local id = 1158532333
local MPS = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(player, id)
MPS.PromptPurchaseFinished:Connect(function(player, id, isPurchased)
if isPurchased then
print(player.Name .. " bought an item with AssetID: " .. id)
game.ReplicatedStorage.GroupCoinEvent:FireServer(player)
else
print(player.Name .. " didn't buy an item with AssetID: " .. id)
end
end)
end)
local id = 1158532333
local MPS = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(player, id)
game.ReplicatedStorage.Events.GroupCoinEvent:FireServer()
end)
serverscript:
local MPS = game:GetService("MarketplaceService")
local id = 1158532333
game.ReplicatedStorage.Events.GroupCoinEvent.OnServerEvent:Connect(function(player)
MPS.PromptPurchaseFinished:Connect(function(player, id, isPurchased)
if isPurchased then
print(player.Name .. " bought an item with AssetID: " .. id)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + math.random(500,1000)
else
print(player.Name .. " didn't buy an item with AssetID: " .. id)
end
end)
end)
local id = 1158532333
local MPS = game:GetService("MarketplaceService")
local player = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
MPS:PromptProductPurchase(player, id)
end)
Server:
local id = 1158532333
local MPS = game:GetService("MarketplaceService")
MPS.PromptPurchaseFinished:Connect(function(player, productid, isPurchased)
if isPurchased and productid == id then
print(player.Name .. " bought an item with AssetID: " .. id)
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + math.random(500,1000)
else
print(player.Name .. " didn't buy an item with AssetID: " .. id)
end
end)