local ItemID = 37252873
local gamepassid = 000000
local gamepass = false
script.Parent.Touched:connect(function(player)
if player.Parent:FindFirstChild('Humanoid') and game.Players:GetPlayerFromCharacter(player.Parent) ~= nil then if gamepass == false then ga#########################################################################################################################
elseif gamepass == true then
game:GetService("MarketplaceService"):PromptPurchase(player, gamepassid)
end
end
end)
local debounce = true
local number = math.random(1,20)
game:GetService("MarketplaceService").ProcessReceipt = function(receiptInfo) --Award the player
for i, player in ipairs(game.Players:GetChildren()) do
if player.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == ItemID and debounce == true then
debounce = false
if number >= 2 then
print("1-2")
game.Lighting.RayGun:clone().Parent = player.Backpack
debounce = true
elseif number >= 3 and number <= 6 then
game.Lighting.RK5:clone().Parent = player.Backpack
debounce = true
print("3-6")
elseif number >=7 and number <= 11 then
game.Lighting.Sheiva:clone().Parent = player.Backpack
debounce = true
elseif number >= 12 and number <= 15 then
print("12-15")
game.Lighting.Bloodhound:clone().Parent = player.Backpack
debounce = true
elseif number >= 16 and number <=20 then
print("16-20")
game.Lighting.AK47:clone().Parent = player.Backpack
wait(0.1)
debounce = true
end
end
end
end
local ds = game:GetService("DataStoreService"):GetDataStore("PurchaseHistory")
local playerProductKey = "p_" .. receiptInfo.PlayerId .. "_p_" .. receiptInfo.PurchaseId
ds:IncrementAsync(playerProductKey, 2)
return Enum.ProductPurchaseDecision.PurchaseGranted
end
What its suppose to do: On purchase its suppose to give a random weapon
the problem: It gives the same one over and over, which is the first one, the RayGun
|