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)

3 comments
You've done what you're question is asking...
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
Change amt to the player's stored value. When the player clicks on the dialog, the script will do: amt = stats:FindFirstChild("Stored").Value