of     2   
chevron_rightchevron_rightchevron_right

Randy_Moss
#180833220Friday, January 01, 2016 4:32 PM GMT

so if I wanted to say local valuee = game.workspace if valuee.value = 0 then the health of human would decrease 1 every second?
AnonyAnonymous
#180833899Friday, January 01, 2016 4:45 PM GMT

The health of each player is a property of the "Humanoid" object, which is inside an individual's character. The health of a given player's character is stored numerically; as a result, you would need to refer to the property with a scripting expression such as the following: "game.Players.Player.Character.Humanoid.Health" Afterwards, you could presumably loop a conditional statement to make a comparison of the individual's health and a specific value.
Randy_Moss
#180835614Friday, January 01, 2016 5:17 PM GMT

so would this be applicable? local health = game.Players.Player.Character.Humanoid.Health local val1 = game.StarterGui.Value function one() repeat wait (1) if val1.Value = 0 then health -1 until val1.Value >0
AnonyAnonymous
#180836141Friday, January 01, 2016 5:26 PM GMT

Despite some syntactical errors, your expression is rather accurate, logically-speaking. I would recommend that you refer directly to the Humanoid object, rather than the Health property itself. local humanoid = game.Players.Player.Character.Humanoid local val1 = game.StarterGui.Value function one() repeat wait (1) if val1.Value == 0 then humanoid.Health = humanoid.Health - 1; until val1.Value > 0 end
Randy_Moss
#180836396Friday, January 01, 2016 5:31 PM GMT

Alright thanks for the help. Appreciate it.
Randy_Moss
#180836535Friday, January 01, 2016 5:34 PM GMT

one problem it says expected end to close got until. something is write with until val1 > 0
PureConcept
#180836682Friday, January 01, 2016 5:36 PM GMT

It is missing an end because there is an if then statement within the loop The Legend of Heroes Sen no Kiseki
AnonyAnonymous
#180836741Friday, January 01, 2016 5:37 PM GMT

Ah yes, it occurs to me that I did not entirely revise the syntactical-errors properly. When you are utilizing functions/conditional statements, it is necessary to use the "end" keyword so that the interpreter will understand whether you are still within the range of the function/statement itself. An example would be the following: function A() end "end" merely informs the interpreter that you have completed the instructions for that given function.
Notwal
#180836758Friday, January 01, 2016 5:37 PM GMT

You need an end for that if statement
Randy_Moss
#180836865Friday, January 01, 2016 5:39 PM GMT

What I want this to do is if the val1.Value is = 0 then your health will drop 1 every second until that value is greater than 0. so then where would I put until val1.Value > 0?
Randy_Moss
#180836997Friday, January 01, 2016 5:41 PM GMT

local humanoid = game.Players.Player.Character.Humanoid local val1 = game.StarterGui.Value function one() repeat wait (1) if val1.Value == 0 then humanoid.Health = humanoid.Health - 1; end until val1.Value > 0 like this? I tried this but it doesn't work (I can already tell by where I put the until it is wrong but I don't know how to fix it)
AnonyAnonymous
#180837002Friday, January 01, 2016 5:41 PM GMT

"so then where would I put until val1.Value > 0?" Ensure that this statement precedes any of the termination keywords or it will be interpreted separately.
Randy_Moss
#180837187Friday, January 01, 2016 5:44 PM GMT

take a look at the script I just posted but I got another question I have it a local script in starter gui is that alright?
AnonyAnonymous
#180837431Friday, January 01, 2016 5:48 PM GMT

"local humanoid = game.Players.Player.Character.Humanoid local val1 = game.StarterGui.Value function one() repeat wait (1) if val1.Value == 0 then humanoid.Health = humanoid.Health - 1; end --This is the end for the conditional statement within the repeat loop; until val1.Value > 0 --This is the condition for the repeat loop; end --This is the end for the function containing the statements itself; " Also, given the client-sided nature of a LocalScript, I would recommend that you place this within a regular script.
Randy_Moss
#180837840Friday, January 01, 2016 5:54 PM GMT

Player is not a valid member of players it says
AnonyAnonymous
#180838207Friday, January 01, 2016 6:00 PM GMT

"Player is not a valid member of players it says" The Lua expression that I provided was just an example. "Player" refers solely to the name of the player that you would like to modify. You may want to ensure that the player is in existence by using an expression such as the following: Player = game.Players:WaitForChild("PlayerName"); Such an expression would wait for an object with the name of the player you are seeking to appear within the Players table. "Child" simply refers to the player.
Randy_Moss
#180838701Friday, January 01, 2016 6:07 PM GMT

if I wanna wait for character what would I put in the parenthesis Character = game.Players:WaitForChild("");
AnonyAnonymous
#180838826Friday, January 01, 2016 6:09 PM GMT

The parentheses contain the name of the player. You can utilize this to access the player's character.
Randy_Moss
#180838929Friday, January 01, 2016 6:11 PM GMT

I'm so confused now it says Character isn't a part of players. sorry.. I'm not that advanced in scripting as you can tell.
AnonyAnonymous
#180839320Friday, January 01, 2016 6:16 PM GMT

"sorry.. I'm not that advanced in scripting as you can tell." Actually, it is my fault for improperly analyzing your Lua expressions. "game.Players:WaitForChild()" functions by waiting for any object with the specified name inside the parentheses to appear within the Players table. "game.Players:WaitForChild().Character" will attempt to access the character of the given object(Assuming it is an actual player). Here is an example: "Character = game.Players:WaitForChild("Player1").Character;" This line would wait for a child known as "Player1" to appear within the Players table, and attempt to access the character of Player1. Inform me of any remaining confusion you may have.
Randy_Moss
#180841490Friday, January 01, 2016 6:46 PM GMT

I added that in and it still says Character is not a valid member of players
AnonyAnonymous
#180841757Friday, January 01, 2016 6:49 PM GMT

Could you show me the current version of your script?
Randy_Moss
#180841792Friday, January 01, 2016 6:50 PM GMT

local humanoid = game.Players.Character.Humanoid local val1 = game.StarterGui.Value Player = game.Players:WaitForChild("PlayerName"); Character = game.Players:WaitForChild("Player1").Character; function one() repeat wait (1) if val1.Value == 0 then humanoid.Health = humanoid.Health - 1; end until val1.Value > 0 end
AnonyAnonymous
#180842028Friday, January 01, 2016 6:53 PM GMT

Now I see the problem that you are having. When I gave the "Player" and "Character" expressions, I was merely giving you them as an example. You can solve your current problem by removing those lines and modifying the line for the humanoid variable to "humanoid = game.Players:WaitForChild("PlayerNameHere").Character.Humanoid".
sublevel
#180844359Friday, January 01, 2016 7:21 PM GMT

function FindPlayerHealth(Playername, DValue, SValue) if (game.Workspace:FindFirstChild(Playername) ~= nil) then while (DValue == 0) do wait() game.Workspace[Playername].Humanoid.Health = game.Workspace[Playername].Humanoid.Health - 1; if (math.abs(game.Workspace[Playername].Humanoid.Health) <= math.abs(SValue)) then break; end; end; return game.Workspace[Playername].Humanoid.Health; end; end; Health = FindPlayerHealth("Player1", 0, 10.00) -- If DValue is equal to 0 then decrement the health of the player until it reaches 10 print(Health);

    of     2   
chevron_rightchevron_rightchevron_right