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

The Leaderstat Value Wont Go Up In The Main Game But It Goes Up In Studio?

Asked by 5 years ago

Heres the script.~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~

local description = "You got a Power Star!!!!!"

local respawn = true

local debounce = false

script.Parent.Touched:connect(function(part)

if not debounce then
    debounce = true

    local player = game.Players:GetPlayerFromCharacter(part.Parent)
    if player then
        if player:findFirstChild("OneTimeItems") and player:findFirstChild("leaderstats") and not player.PlayerGui:findFirstChild("ItemGet") then
            if not player.OneTimeItems:findFirstChild(identifier) then

                --create an identifier (accoutrements have cool icons)
                local newidentifier = Instance.new("Accoutrement",player.OneTimeItems)
                newidentifier.Name = identifier

                --update stats
                local stats = player.leaderstats:findFirstChild(stat)
                if stats then
                    stats.Value = stats.Value + 1
                else
                    print(stat.." not found in leaderstats")
                end
0
findFirstChild and connect and the parent argument are deprecated, use FindFirstChild, Connect, and assign the parent in another line, last User#19524 175 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

The Stats Variable is Stars.

Ad

Answer this question