Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

1 comment

0

What is the error message?

1 answer

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)

This discussion is preserved as it was. New answers, comments, and votes are closed.