For some reason, all of the players money is stats2 are not being transfered.... this is what I have tried:
local stats = player:findFirstChild("leaderstats")
---------
amt= stats:FindFirstChild("Stored").Value
---------
script.Parent.DialogChoiceSelected:connect(function(player, choice)
if (choice == script.Parent.Choice5) 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.Choice6) 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)

1 comment
If this is the whole script, then
playeron line 1 is not defined.