Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Tycoon cash script problem unable to upgrade using purchased cash ?

Asked by 3 years ago
Edited 3 years ago

Hi all. I have everything working and when i do the cash purchase i do get the money in Player status but it wont let me use it to upgrade Tycoon.

I have used regular Tycoon to test it and here is the plugin script

Thank you all and here are the links to the images of problem.

https://web.roblox.com/library/464848250/Buy-KOs-and-Cash-For-hke12-OnceILived

https://ibb.co/yqYksRb

https://ibb.co/y4Sd9Sq

`` <p>

local plr = script.Parent.Parent.Parent.Parent.Parent
local link =game:GetService("MarketplaceService")
deb = 0


script.Parent.MouseButton1Click:connect(function()
local marketId = 36578889
link:PromptProductPurchase(plr,marketId)
link.ProcessReceipt = function(receiptInfo)
if Enum.ProductPurchaseDecision.PurchaseGranted and receiptInfo.PlayerId == plr.userId then
if deb == 0 then
deb = 1
plr.leaderstats.Cash.Value = plr.leaderstats.Cash.Value + 6000 --Alter what stat you would like to increase or decrease after the player has purchased.
wait(1)
deb = 0
end
end
end
end)

When i use this code with just a button and no purchase script it works.

deb = false
script.Parent.Touched:connect(function(part)
    if game.Players:FindFirstChild(part.Parent.Name) then
        if deb == false then
            deb = true
            local plr = game.ServerStorage.PlayerMoney:FindFirstChild(part.Parent.Name)
            script.Parent.BrickColor = BrickColor.new("Bright red")
            plr.Value = plr.Value + script.Parent.Parent.Amount.Value
            wait(script.Parent.Parent.TimeToWait.Value)
            deb = false
            script.Parent.BrickColor = BrickColor.new("Bright green")
        end
    end
end)

Answer this question