game.Players.PlayerAdded:connect(function(Player) function Leaderstats() Leaderstats = Instance.new("IntValue") Leaderstats.Parent = Player Leaderstats.Name = "Leaderstats" LeaderstatsChildren = Leaderstats:GetChildren() for LeaderstatsCount = 1, #LeaderstatsChildren do Leaderstats.Value = Leaderstats.Children end end function PowerLevel() end function Attack() end function Defense() end function Agility() end function Rank() end Leaderstats() PowerLevel() Attack() Defense() Agility() Rank() end)
No.
The leaderstats object's name should be "leaderstats"
not "Leaderstats"
(lowercase).
The Children of the new IntValue will be an empty list, since you just created it.
This means the for
loop following it does not run. However, if it did run, Leaderstats.Children
would result in an error, since an IntValue doesn't have a Children
property.
You should also be careful, because the function Leaderstats
is sharing a name with the IntValue Leaderstats
. You should define it the IntValue variable as local
to avoid this, and perhaps rename one of them (I would suggest making the IntValue variable lowercase)