Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can I use this IF?

Asked by 10 years ago

Hello! I am making a custom health billboard gui for my game. I can make the gui be inserted into the player and it works! I am trying to make it so that that different parts of the gui are visible depending on the health. with this part I want the first gui to be visible when the health is in between 75 and 100. I don't know How I can make the two in one if statement. I tried <= 100, >=75 but it does not know what the comma is. How can I do this?

if script.Parent.Parent.Humanoid.Health == 100 then -- I want to make this so that it works when it is between 75 and 100
    script.Parent.Light100.Visible = true
else
    script.Parent.Light100.Visible = false
end


1 answer

Log in to vote
3
Answered by
RedCombee 585 Moderation Voter
10 years ago
if script.Parent.Parent.Humanoid.Health >=75 and script.Parent.Parent.Humanoid.Health <= 100 then

Good luck on your project!

0
Okay this clears it up! Thanks! minikitkat 687 — 10y
0
To elaborate (you really should explain your answers), >= means 'greater than or equal to' and <= is the opposite. You probably learned about less-than/greater-than in basic arithmetic. This is just that. It's checking if the health is greater than or equal to 75 and less than or equal to 100. Perci1 4988 — 10y
0
@Perci1, he clearly knows what those mean already. He mentions using those previously in his script, and I do explain my answers most of the time. RedCombee 585 — 10y
Ad

Answer this question