killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 25 Feb 2015 04:25 PM |
This script is made so it bases your health on the leaderboard
------
game.Players.ChildAdded:connect(function(player) player.CharacterAdded:connect(function(char) char.Humanoid.MaxHealth = player.leaderstats.Weight.Value end) end)
----
but if weight changes, the maxhealth stays the same. How should I make it so the maxhealth would change with the value of weight? |
|
|
| Report Abuse |
|
|
| |
|
gerov
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 5504 |
|
|
| 25 Feb 2015 04:27 PM |
player.leaderstats.Weight.Value.Changed:connect(function() --do stuff end)
Why don't you take a seat over there? |
|
|
| Report Abuse |
|
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
| |
|
IoIiderp
|
  |
| Joined: 05 Feb 2012 |
| Total Posts: 8613 |
|
|
| 25 Feb 2015 04:27 PM |
@gerov Wouldn't work because .Changed works with an instance and not with a number. |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 25 Feb 2015 04:28 PM |
local player = game.Players.LocalPlayer local g = player.leaderstats.Weight.Value
function Key() char.Humanoid.MaxHealth = player.leaderstats.Weight.Value end
Key() g.Changed:connect(Key)
|
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
| |
|
gerov
|
  |
| Joined: 05 Feb 2011 |
| Total Posts: 5504 |
|
|
| 25 Feb 2015 04:33 PM |
@Lolid Oh :p, I have never used it, so I was just guessing how it would work.
Why don't you take a seat over there? |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 25 Feb 2015 05:20 PM |
So here's my attempt
game.Players.ChildAdded:connect(function(player) player.CharacterAdded:connect(function(char) char.Humanoid.MaxHealth = player.leaderstats.Weight.Value player.leaderstats.Weight.Value.Changed:connect(function() char.Humanoid.MaxHealth = player.leaderstats.Weight.newValue end) end) end)
It makes your weight your hp, but if weight changes, your hp doesn't until you reset. I can't have my players resetting all of the time, so the issue still exist. |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 25 Feb 2015 05:56 PM |
| you numbskull i just gave you the script |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 25 Feb 2015 06:05 PM |
| I tried it and it didn't work. I may have not done it how you wanted, as I might be a numbskull but could you try to be more clear? |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 25 Feb 2015 06:14 PM |
local player = game.Players.LocalPlayer --if this dont work chage from local to function local char = player.Character local g = player.leaderstats.Weight.Value
function Key() char.Humanoid.MaxHealth = player.leaderstats.Weight.Value end
Key() g.Changed:connect(Key)
this should work |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 25 Feb 2015 06:16 PM |
local player = game.Players.LocalPlayer local g = player.leaderstats.Weight.Value
function Key() char.Humanoid.MaxHealth = player.leaderstats.Weight.Value end
Key() g.Changed:connect(Key) char = player.Character
----
This doesn't work. |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 25 Feb 2015 06:20 PM |
| Your latest doesn't work either, could you test it in your game? |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 25 Feb 2015 06:24 PM |
local player = game.Players.LocalPlayer local char = player.Character -0000---------------------------this is not on that local g = player.leaderstats.Weight.Value
function Key() char.Humanoid.MaxHealth = player.leaderstats.Weight.Value end
Key() g.Changed:connect(Key)
look up at the comment ill test just in case |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 25 Feb 2015 06:48 PM |
| I got nothing from that script either. |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 25 Feb 2015 06:50 PM |
oops i apologize remove game.players.local player that only works for local scripts
and add parents instead im pretty sure theres 2 or 3 |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 25 Feb 2015 07:34 PM |
I still know very little about scripting to know what you want :/
I'm good at linking things that already have a foundation but creating new things isn't in my skillset yet.l |
|
|
| Report Abuse |
|
|
GreedTaka
|
  |
| Joined: 12 Dec 2014 |
| Total Posts: 1503 |
|
|
| 25 Feb 2015 07:53 PM |
local player = game.Players.LocalPlayer local char = game.Players:getPlayerFromCharacter() local g = player.leaderstats.Weight.Value
function Key() char.Humanoid.MaxHealth = player.leaderstats.Weight.Value end
Key() g.Changed:connect(Key) |
|
|
| Report Abuse |
|
|
killette2
|
  |
| Joined: 16 Sep 2009 |
| Total Posts: 3502 |
|
|
| 25 Feb 2015 09:45 PM |
| Still not doing anything, it doesn't have any errors in the script the script just isn't doing what it should. I run a test, check my humanoid and it's 100, change weight still 100, reset, still 100. |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 09:48 PM |
Disregard all the other attempts of help And focus on this easy alternative! Put a gui in the StarterGui put a script in it then in the script make it
while true do player = script.Player.Player.Player --Make sure script is in the gui, not a frame. Wei = player.leaderstats.Weight.Value
player.Character.Humanoid.MaxHealth.Value = Wei
wait() end |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 09:49 PM |
You made the same exact post yesterday and I answered it then http://www.roblox.com/Forum/ShowPost.aspx?PostID=156714084 |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 09:49 PM |
Remove the .Value from the line "MaxHealth.Value" because that's incorrect.
|
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 09:50 PM |
omfg
I scripted that like a noob
let me repair it omg
while true do
player = script.Parent.Parent.Parent wei = player.leaderstats.Weight.Value
wait() player.Character.Humanoid.MaxHealth = wei
end |
|
|
| Report Abuse |
|
|
|
| 25 Feb 2015 09:54 PM |
Put this code inside of a LocalScript.
Put the script into StarterGui.
local Player = game.Players.LocalPlayer while Player.Character == nil do wait() end local Character = Player.Character local Humanoid = Character:WaitForChild("Humanoid")
local Weight = Player.leaderstats.Weight Weight.Changed:connect(function() Humanoid.MaxHealth = Weight.Value Humanoid.Health = Humanoid.MaxHealth -- Assigns current health to new maxhealth, remove this line if this consequence is undesired end) |
|
|
| Report Abuse |
|
|