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

What is the problem with this script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

For some reason, all of the players money is stats2 are not being transfered.... this is what I have tried:

01local stats = player:findFirstChild("leaderstats")
02---------
03amt= stats:FindFirstChild("Stored").Value
04---------
05 
06script.Parent.DialogChoiceSelected:connect(function(player, choice)
07    if (choice == script.Parent.Choice5) then
08        if (player ~= nil) then
09            local stats = player:findFirstChild("leaderstats")
10            local otherStats = player:findFirstChild("Stats2")
11            if (stats ~= nil and otherStats ~= nil) then
12                local playerStored = otherStats:findFirstChild("Stored")
13                if stats:findFirstChild("Money").Value >= amt then
14                    otherStats:findFirstChild("Stored").Value = otherStats:findFirstChild("Stored").Value + amt
15                    stats:findFirstChild("Money").Value = stats:findFirstChild("Money").Value - amt
View all 34 lines...
1
If this is the whole script, then `player` on line 1 is not defined. 1waffle1 2908 — 9y

Answer this question