#Just a question on setting up player values.

1 messages · Page 1 of 1 (latest)

bleak bramble
#
Entity.newPlayer = function(player:Player)
    local Object = {}
    Object.Attributes = {
        Vitality = {
            Points = Instance.new("IntValue"),
        },
    }
    
    Object.Health = {
        HP = Instance.new("IntValue"),
        MAXHP = Instance.new("IntValue"),
    }
    
    Object.Attributes.Vitality.Points.Changed:Connect(function(value)
        Object.Health.MAXHP.Value = value*10
    end)
    
    Object.Client = player:WaitForChild("Data")
    return Object
end```
vapid tiger
#

is there a problem with the code?

bleak bramble
#

is this optimal if i wanted to have an attribute system or should push health under the vitality table

#

just the structure of the code i guess

vapid tiger
#

yeah it should work on first glance