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

Level gui system help?

Asked by 8 years ago

Long story short, im making a game where theres a level up system based on kills and I use the script

local maxlevel = 100
game.Players.PlayerAdded:connect(function(player)
    local stats = Instance.new("IntValue", player)
    stats.Name = "leaderstats"

    local level = Instance.new("IntValue", stats)
    level.Name = "Level"
    level.Value = 1

    local exp = Instance.new("IntValue", stats)
    exp.Name = "Exp"
    exp.Value = 0

    while wait() do
        local extralevel = level.Value
        local expneed = ((extralevel * 2) - 1) * 50
        if level.Value < maxlevel then
            if exp.Value >= expneed then
                level.Value = level.Value + 1
                exp.Value = exp.Value - expneed
            end
        end
    end
end)

2 questions: 1, I made a working gui version of displaying the level, HOWEVER it wont update when you level up it works the first time but wont no more, help, to go along with the leveling up. 2, Using this script how would I make it so if you kill someone you get exp?

0
Can you show the script for the gui. Also you can use the Died Event on Humanoids to get Exp on kill yoshi8080 445 — 8y

1 answer

Log in to vote
0
Answered by
Aepeus 59
8 years ago

Not sure as you don't have the script for the display but hopefully this fixes your problem.

local player = game.Players.LocalPlayer
local stats = player:WaitForChild("leaderstats")
local level = stats:WaitForChild("level") -- change level to your statname

function update()
script.Parent.Text = level.Value
end

update()
level.Changed:connect()
Ad

Answer this question