I have spent ages trying to understand how I’m supposed to do this!? I clearly need some help to understand player handlers and don’t know what I’m doing. I’m trying to make the stats via module scripts, and handle all through updates to it, but it doesn’t update on both the client and server: the code is as such:
local Stats = {
["Pure"] = {
["Health"] = 100
},
["Multiplier"] = {
["Health"] = 1
}
["Set"] = {
["Health"] = 100
}
}
local Stats2 = Stats
local function updateStats(Stat)
if Stat then
if Stat.Name == "Set" and Stat:GetChildren() then
for I,Value in pairs(Stat:GetChildren()) do
Stats2[Stat.Name][Value.Name] = Value.Value
end
elseif Stat.Name == "Pure" and Stat:GetChildren() then
for I,Value in pairs(Stat:GetChildren()) do
Stats2[Stat.Name][Value.Name] = Stats[Stat.Name][Value.Name] + Value.Value
end
elseif Stat.Name == "Multiplier" and Stat:GetChildren() then
for I,Value in pairs(Stat:GetChildren()) do
Stats2[Stat.Name][Value.Name] = Stats[Stat.Name][Value.Name] + Value.Value
end
end
end
end
function Stats2.Update(mod)
updateStats(mod)
end
return Stats2
It sort of returns the stats but as I stated in the latter It wont work very well. I want it to include a
- Set Statistic that will set the base stat at this value
- Pure statistic that will add to the base
- Multiplier that will, well multiply
Any help would be appreciated, I have spent so long figuring this out that its hurting