ResetonMax = false
save = true
function Entered(player)
wait()
if player:findFirstChild("leaderstats") ~= nil then
player.leaderstats:remove()
end
stats = Instance.new("Model")
stats.Parent = player
stats.Name = "Stats"
--Money Stats
money = Instance.new("IntValue")
money.Parent = stats
money.Name = "Gold"
money.Value = 1 --How much money do you want them to start with?
money2 = Instance.new("IntValue")
money2.Parent = stats
money2.Name = "Level"
money2.Value = 1 --How much money do you want them to start with?
money3 = Instance.new("IntValue")
money3.Parent = stats
money3.Name = "EXP"
money3.Value = 1 --How much money do you want them to start with?
money4 = Instance.new("IntValue")
money4.Parent = stats
money4.Name = "Tokens"
money4.Value = 1 --How much money do you want them to start with?
--Other Backpacks
weapons = Instance.new("Model")
weapons.Parent = player
weapons.Name = "Weapons"
weapon = Instance.new("Model")
weapon.Parent = player
weapon.Name = "CurrentArmor"
--Attributes
strength = Instance.new("IntValue")
strength.Parent = stats
strength.Name = "Strength"
strength.Value = 1
con = Instance.new("IntValue")
con.Parent = stats
con.Name = "Constitution"
con.Value = 1
int = Instance.new("IntValue")
int.Parent = stats
int.Name = "Intelligence"
int.Value = 1
dex = Instance.new("IntValue")
dex.Parent = stats
dex.Name = "Dexterity"
dex.Value = 1
--Player Other Stats
hp = Instance.new("IntValue")
hp.Parent = stats
hp.Name = "MAXHealth"
hp.Value = 100
mana = Instance.new("IntValue")
mana.Parent = stats
mana.Name = "MAXMana"
mana.Value = 100
xp = Instance.new("IntValue")
xp.Parent = stats
xp.Name = "MAXEXP"
xp.Value = 100
nxp = Instance.new("IntValue")
nxp.Parent = stats
nxp.Name = "Mana"
nxp.Value = 1
end
game.Players.PlayerAdded:connect(Entered)
c = game.Players:GetChildren()
for i=1, #c do
Entered(c[i])
end
function levelup()
player.Stats.Level.Value =player.Stats.Level.Value +1
player.Stats.EXP.Value = 0
print("Level Up")
end
function update()
player.Stats.Strength.Value = player.Stats.Strength.Value +2
player.Stats.Dexterty.Value = player.Stats.Dexterity.Value +2
player.Stats.Intelligence.Value = player.Stats.Intelligence.Value +2
player.Stats.Constitution.Value = player.Stats.Constitution.Value +2
player.Stats.MAXHealth.Value = player.Stats.MAXHealth.Value +15
player.Stats.MAXMana.Value = player.Stats.MAXMana.Value +10
player.Stats.MAXEXP.Value = player.Stats.MAXEXP.Value +100
end
game.Players.PlayerAdded:connect(function(player)
player.Stats.EXP.Changed:connect(function(c)
if player.Stats.EXP.Value==MAXEXP.Value then
print("The player has leveled up!")
levelup()
end
end)
end)
player.Stats.Level.Changed:connect(function()
update()
end)
Nothing works, except the first part. Where it clones everything in it's place. |