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

How do I change the amount so that all the players money is transferred?

Asked by 9 years ago

How do I change the amount so that all the players money is transferred? Right now it is set to 100$.

---------
amt= 100
---------

script.Parent.DialogChoiceSelected:connect(function(player, choice)
    if (choice == script.Parent.Choice1) then
        if (player ~= nil) then
            local stats = player:findFirstChild("leaderstats")
            local otherStats = player:findFirstChild("Stats2")
            if (stats ~= nil and otherStats ~= nil) then
                local playerStored = otherStats:findFirstChild("Stored")
                if stats:findFirstChild("Money").Value >= amt then
                    otherStats:findFirstChild("Stored").Value = otherStats:findFirstChild("Stored").Value + amt
                    stats:findFirstChild("Money").Value = stats:findFirstChild("Money").Value - amt
                end
            end
        end
    end

    if (choice == script.Parent.Choice2) then
        if (player ~= nil) then
            local stats = player:findFirstChild("leaderstats")
            local otherStats = player:findFirstChild("Stats2")
            if (stats ~= nil and otherStats ~= nil) then
                local playerStored = otherStats:findFirstChild("Stored")
                if otherStats:findFirstChild("Stored").Value >= amt then
                    stats:findFirstChild("Money").Value = stats:findFirstChild("Money").Value + amt
                    otherStats:findFirstChild("Stored").Value = otherStats:findFirstChild("Stored").Value - amt             
                end
            end
        end
    end
end)
0
You've done what you're question is asking... TheDeadlyPanther 2460 — 9y
0
No, but all the money the player has. Like if I had 97 dollars, how could I make the script take all 97, without needing 100 hurricanedog 0 — 9y
0
Change amt to the player's stored value. When the player clicks on the dialog, the script will do: amt = stats:FindFirstChild("Stored").Value TheDeadlyPanther 2460 — 9y

Answer this question