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

Why is this appearing? "W002: Global 'stats' is deprecated"

Asked by 8 years ago

I recieved help, to make the amount equal to what the player has, but for some reason, the word stats is underlined blue, and this pops up, "W002: Global 'stats' is deprecated". Could anyone help, I don't know what I should do. Thanks!

---------
amt=stats:FindFirstChild("Stored").Value
---------

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)

1 answer

Log in to vote
1
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
8 years ago

You never defined stats so Roblox thinks you're referring to this deprecated global that also happens to be called stats.

1
Ok, so what do I do? Local stats = player:findFirstChild("leaderstats") hurricanedog 0 — 8y
0
Yes. General_Scripter 425 — 8y
Ad

Answer this question