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

When I publish my game to roblox it says script will won't be published?

Asked by 4 years ago

I have leaderstats in the game but when I test in studio they are there and when I go to my game they are not, Could the reason be because the error message and how do I fix

0
What is the error message? User#32819 0 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("Folder", player)
    leaderstats.Name = "leaderstats"

    local Lvl = Instance.new("NumberValue", leaderstats)
    Lvl.Name = "Level"
    Lvl.Value = 1

    local EXP = Instance.new("NumberValue", leaderstats)
    EXP.Name = "EXP"

    local MaxEXP = Instance.new("IntValue", leaderstats)
    MaxEXP.Name = "MaxExp"
    MaxEXP.Value = 100 * (Lvl.Value / 2)

    game.ServerStorage.GiveExp.Event:Connect(function(amount,plr)
        if player.Name == plr.Name then
            EXP.Value = EXP.Value + amount
        end
    end)
    EXP:GetPropertyChangedSignal("Value"):Connect(function()
        if EXP.Value >= MaxEXP.Value then
            EXP.Value = EXP.Value - MaxEXP.Value
            wait(0.01)
            Lvl.Value = Lvl.Value + 1
            MaxEXP.Value = 100 * (Lvl.Value)
        end
    end)
end)
Ad

Answer this question