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

i need lvling system that gives more health per lvl?

Asked by 4 years ago

this is my script

game.Players.PlayerAdded:Connect(function(plr)

    local stats = Instance.new("IntValue",plr)
    stats.Name = "leaderstats"

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

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

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

        XP.Changed:connect(function()
        lvl.Value = math.floor(XP.Value/100)

    lvl.Changed:Connect(function()
        local char = Player.Character or Player.CharacterAdded:wait()
        local Humanoid = char:WaitForChild("Humanoid")
        Humanoid.MaxHealth = 100 + (lvl.Value * 10)
        Humanoid.Health = Humanoid.MaxHealth
    end)
end)

    end)
0
Uh, what happen when the script run? We can't help you because we don't know what is your problem. Block_manvn 395 — 4y
0
well it makes the leaderstats and makes me lvl up when i get 100 XP but i want it to give me more health but that isnt working Ninjalord1003 2 — 4y
0
Use :GetPropertyChangedSignal() instead of Changed. The function will fire Changed event for specific Property https://developer.roblox.com/api-reference/function/Instance/GetPropertyChangedSignal Block_manvn 395 — 4y

Answer this question