This code looks fine however, you need to refresh the "Total Power" Value each time one of the other stats increase. For example
01 | game.Players.PlayerAdded:Connect( function (plr) |
02 | local leaderstats = Instance.new( "Folder" , plr) |
03 | leaderstats.Name = "leaderstats" |
05 | local Strength = Instance.new( "IntValue" , leaderstats) |
06 | Strength.Name = "Strength" |
08 | local Endurance = Instance.new( "IntValue" , leaderstats) |
09 | Endurance.Name = "Endurance" |
11 | local Psychic = Instance.new( "IntValue" , leaderstats) |
12 | Psychic.Name = "Psychic" |
14 | local TotalPower = Instance.new( "IntValue" , leaderstats) |
15 | TotalPower.Name = "Total Power" |
16 | TotalPower.Value = Strength.Value + Endurance.Value + Psychic.Value |
18 | TotalPower.Value = Strength.Value + Endurance.Value + Psychic.Value |
21 | for index,value in ipairs (leaderstats:GetChildren()) do |
23 | value.Changed:Connect( function () |
(This code may not work, I haven't tested it.)