killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 24 Feb 2015 09:59 PM |
How would I do this? I tried writing this script to make it 1 for example, but it does not work.
-----
local Weight = Instance.new("IntValue",ls) Weight.Value = 1 Weight.Name = "Weight"
HP = Instance.new("StringValue",ls) HP.Name = "HP" repeat wait() until player.Character.Humanoid player.Character.Humanoid.Changed:connect(function() HP.Value = (player.Character.Humanoid.MaxHealth) player.Character.Humanoid.MaxHealth = Weight.Value end) |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 10:07 PM |
| I don't know if this is th ereason or not, but Weight is an Integer Value which means it has to be a whole number. Players' Health are usually not an integer when healing. |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 10:08 PM |
| I'm pretty sure if you try to assign a Float value to an Integer in Lua it'll just clamp it. |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 10:11 PM |
local Health = 100 local MaxHealth = 100
local Leaderstats = Instance.new("StringValue") --parent this to the player local HealthValue = Instance.new("NumberValue", leaderstats) HealthValue.Name = "HP" HealthValue.Value = Health
myPlayer.Character.Humanoid.HealthChanged(newHealth) -- you need to use healthchanged like this health = newHealth HealthValue.Value = health end |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 24 Feb 2015 10:31 PM |
Putting that in just breaks my whole leaderboard. It works like this currently
-------------
function onPlayerEntered(player)
--stats
local ls = Instance.new("IntValue",player) ls.Name = "leaderstats"
local Stamina = Instance.new("IntValue",ls) Stamina.Value = 100 Stamina.Name = "Stamina"
local Will = Instance.new("IntValue",ls) Will.Value = 100 Will.Name = "Will"
local Endurance = Instance.new("IntValue",ls) Endurance.Value = 1 Endurance.Name = "Endurance"
------------------ |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 10:41 PM |
| In his script replace MyPlayer with player |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 24 Feb 2015 11:23 PM |
Ok I wrote this
-------------
local MaxHealth = 99
local HealthValue = Instance.new("NumberValue", ls) HealthValue.Name = "HP" HealthValue.Value = Maxhealth
Player.Character.Humanoid.HealthChanged(newHealth) -- you need to use healthchanged like this MaxHealth = newHealth HealthValue.Value = MaxHealth end
------------
But it breaks the end at the very end of my script and I don't know why. |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 24 Feb 2015 11:47 PM |
The whole script
----
function onPlayerEntered(player)
--stats
local ls = Instance.new("IntValue",player) ls.Name = "leaderstats"
local Stamina = Instance.new("IntValue",ls) Stamina.Value = 100 Stamina.Name = "Stamina"
local Will = Instance.new("IntValue",ls) Will.Value = 100 Will.Name = "Will"
local Endurance = Instance.new("IntValue",ls) Endurance.Value = 1 Endurance.Name = "Endurance"
local Enduranceexp = Instance.new("IntValue",Endurance) Enduranceexp.Value = 0 Enduranceexp.Name = "Enduranceexp"
Enduranceexp.Changed:connect(function() Endurance.Value = Enduranceexp.Value^.5 end)
local Weight = Instance.new("IntValue",ls) Weight.Value = 1 Weight.Name = "Weight"
local MaxHealth = 99
local HealthValue = Instance.new("NumberValue",ls) HealthValue.Name = "HP" HealthValue.Value = Maxhealth
Player.Character.Humanoid.HealthChanged(newHealth) -- you need to use healthchanged like this MaxHealth = newHealth HealthValue.Value = MaxHealth end
local Gold = Instance.new("IntValue",ls) Gold.Value = 100 Gold.Name = "Gold"
local Plantlore = Instance.new("IntValue",ls) Plantlore.Value = 1 Plantlore.Name = "Plantlore"
local Plantloreexp = Instance.new("IntValue",Plantlore) Plantloreexp.Value = 1 Plantloreexp.Name = "Plantloreexp"
Plantloreexp.Changed:connect(function() Plantlore.Value = Plantloreexp.Value^.5 end)
local Fishing = Instance.new("IntValue",ls) Fishing.Value = 1 Fishing.Name = "Fishing"
local Fishingexp = Instance.new("IntValue",Fishing) Fishingexp.Value = 1 Fishingexp.Name = "Fishingexp"
Fishingexp.Changed:connect(function() Fishing.Value = Fishingexp.Value^.5 end)
local Cooking = Instance.new("IntValue",ls) Cooking.Value = 1 Cooking.Name = "Cooking"
local Cookingexp = Instance.new("IntValue",Cooking) Cookingexp.Value = 1 Cookingexp.Name = "Cookingexp"
Cookingexp.Changed:connect(function() Cooking.Value = Cookingexp.Value^.5 end)
local Mining = Instance.new("IntValue",ls) Mining.Value = 1 Mining.Name = "Mining"
local Miningexp = Instance.new("IntValue",Mining) Miningexp.Value = 1 Miningexp.Name = "Miningexp"
Miningexp.Changed:connect(function() Mining.Value = Miningexp.Value^.5 end)
local Smithing = Instance.new("IntValue",ls) Smithing.Value = 1 Smithing.Name = "Smithing"
local Smithingexp = Instance.new("IntValue",Smithing) Smithingexp.Value = 1 Smithingexp.Name = "Smithingexp"
Smithingexp.Changed:connect(function() Smithing.Value = Smithingexp.Value^.5 end)
local Magic = Instance.new("IntValue",ls) Magic.Value = 1 Magic.Name = "Magic"
local Magicexp = Instance.new("IntValue",Magic) Magicexp.Value = 1 Magicexp.Name = "Magicexp"
Magicexp.Changed:connect(function() Magic.Value = Magicexp.Value^.5 end)
local Mana = Instance.new("IntValue",ls) Mana.Value = 10 Mana.Name = "Mana"
local Intel = Instance.new("IntValue",ls) Intel.Value = 1 Intel.Name = "Intel"
local Intelexp = Instance.new("IntValue",Intel) Intelexp.Value = 1 Intelexp.Name = "Intelexp"
Intelexp.Changed:connect(function() Intel.Value = Intelexp.Value^.5 end)
local Aura = Instance.new("IntValue",ls) Aura.Value = 0 Aura.Name = "Aura"
end game.Players.ChildAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
| |
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
| |
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
| |
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
| |
|