wait(10)
print("Starting!")
repeat wait()until game.Players.LocalPlayer
print("Found Player")
plr=game:service("Players").LocalPlayer
print("Player has been set")
repeat wait()until plr:FindFirstChild("leaderstats")
print("Found Leaderstats")
repeat wait()until plr.Character~=nil
print("Player has been found")
ar=plr.leaderstats:FindFirstChild("Armor")
print("Found Armor")
pl=plr.Character:FindFirstChild("Humanoid")
print("Found Humanoid")
if ar~=nil then
print("Starting to change health")
pl.MaxHealth=plr.leaderstats.Armor + 100
print("MaxHealth has been changed!")
pl.Health=pl.Character.MaxHealth
print("Health has been changed!")
elseif not plr2~=nil or not plr:FindFirstChild("leaderstats")~=nil or not plr:FindFirstChild("leaderstats"):FindFirstChild("Armor")~=nil then
print("Humanoid does not exist")
end
Edit: it now says that line 25 is erroring.
I have a script, what it does is finds the leaderstat 'Armor' replaces the persons max health and current health (+100) to their health. and max health.
The output says at line 6, that "Armor" isn't a valid member of IntValue.
And if anyone is wondering.. Here is the DataSave that I use to create the leaderstats...
function DataHandler(p,o,key)
local types = {
IntValue = "Number";
NumberValue = "Number";
ObjectValue = "Instance";
BoolValue = "Boolean";
StringValue="String";
}
local t = types[o.ClassName]
if (not t) then return end
key = (type(key) == "string" and key or o.Name)
key = (#key > 0 and key or key.Name == o.Name and o.ClassName or o.Name)
if (not p.DataReady) then
p:WaitForDataReady()
end
local Save,Load = p[("Save%s"):format(t)],p[("Load%s"):format(t)]
o.Value = Load(p,key)
local lastV = o.Value
o.Changed:connect(function(v)
lastV = v
Delay(1,function()
if (lastV ~= v) then return end
Save(p,key,v)
end)
end)
end
game.Players.PlayerAdded:connect(function(player)
local l = Instance.new("IntValue",player)
l.Name = "leaderstats"
local money = Instance.new("IntValue",l)
money.Name = "KOs"
DataHandler(player,money,"TheMoney")
local cashmoney = Instance.new("IntValue",l)
cashmoney.Name = "Wipeouts"
DataHandler(player,cashmoney,"ThePoints")
local mh = Instance.new("IntValue",l)
mh.Name = "Armor"
DataHandler(player,mh,"MaxHealths")
end)

1 comment
I edited the script around.. and trying to fix some things.. and now it says this: "attempt to perform arithmetic on field 'Armor' (a userdata value)" This is on line 25. I will update the script on top to show what i have it set as now.