|
| 05 Dec 2015 05:14 PM |
Why does this keep changing the text color to yellow
----
wait (2) local player = game.Players.LocalPlayer local character = player.Character local i = 0 local Hunger = character.Hunger.Value local Thirst = character.Thirst.Value local Gui = script.Parent
repeat i = i + 0.0001 Gui.HungerAndThirst.Hunger.Text = "HUNGER: "..Hunger.."!" Gui.HungerAndThirst.Thirst.Text = "THIRST: "..Thirst.."!" if Hunger >70 then Gui.HungerAndThirst.Hunger.TextColor3 = Color3.new(2, 141, 0) end if Thirst >70 then Gui.HungerAndThirst.Thirst.TextColor3 = Color3.new(2, 141, 0) end if Hunger <=70 then Gui.HungerAndThirst.Hunger.TextColor3 = Color3.new(217, 217, 66) end if Thirst <=70 then Gui.HungerAndThirst.Thirst.TextColor3 = Color3.new(217, 217, 66) end if Thirst <=50 then Gui.HungerAndThirst.Thirst.TextColor3 = Color3.new(255, 0, 0) end if Hunger <=50 then Gui.HungerAndThirst.Thirst.TextColor3 = Color3.new(255, 0, 0) end
wait (0.1) until i == math.huge
---
No errors in the console
***It's only suppose to turn yellow when it's below or equal to 70 yet it's doing it when it's above 70***
**If two people on the opposite sides of earth drop a piece of bread, the world briefly becomes a sandwich.** |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 05:18 PM |
Elseif?
if Hunger >70 then Gui.HungerAndThirst.Hunger.TextColor3 = Color3.new(2, 141, 0) elseif Hunger <=70 then Gui.HungerAndThirst.Hunger.TextColor3 = Color3.new(217, 217, 66)
and so on... |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 05 Dec 2015 05:21 PM |
i read your name
what are you going to do now
-Completed with no bugs...
|
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 05:35 PM |
Nope, Still didn't work. ;-;
**If two people on the opposite sides of earth drop a piece of bread, the world briefly becomes a sandwich.** |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 05:35 PM |
Tried it, nothing, still yellow
**If two people on the opposite sides of earth drop a piece of bread, the world briefly becomes a sandwich.** |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 05:43 PM |
Try:
wait (2) local player = game.Players.LocalPlayer local character = player.Character local Hunger = character.Hunger.Value local Thirst = character.Thirst.Value local Gui = script.Parent
while wait(0.1) do Gui.HungerAndThirst.Hunger.Text = "HUNGER: "..Hunger.."!" Gui.HungerAndThirst.Thirst.Text = "THIRST: "..Thirst.."!" if Hunger > 70 then Gui.HungerAndThirst.Hunger.TextColor3 = Color3.new(2, 141, 0) elseif Hunger <= 70 then Gui.HungerAndThirst.Hunger.TextColor3 = Color3.new(217, 217, 66) elseif Hunger <= 50 then Gui.HungerAndThirst.Thirst.TextColor3 = Color3.new(255, 0, 0) end if Thirst > 70 then Gui.HungerAndThirst.Thirst.TextColor3 = Color3.new(2, 141, 0) elseif Thirst <= 70 then Gui.HungerAndThirst.Thirst.TextColor3 = Color3.new(217, 217, 66) elseif Thirst <= 50 then Gui.HungerAndThirst.Thirst.TextColor3 = Color3.new(255, 0, 0) end end |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 09:23 PM |
Still yellow
**If two people on the opposite sides of earth drop a piece of bread, the world briefly becomes a sandwich.** |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
|
| 05 Dec 2015 09:24 PM |
Any color3 values need to be divided by 255 or they turn funky. Any values other than 0.
Ex:
script.Parent.BackgroundColor3 = Color3.new(233/255,0,5/255) |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 09:30 PM |
THANK YOU SO MUCH :D
**If two people on the opposite sides of earth drop a piece of bread, the world briefly becomes a sandwich.** |
|
|
| Report Abuse |
|
|
62GB
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 4157 |
|
| |
|
|
| 05 Dec 2015 09:36 PM |
New problem arose:
It's changing the value or updating the number:
" ----changing number script----- wait (2)
local player = game.Players.LocalPlayer local character = player.Character local Hunger = character.Hunger.Value local Thirst = character.Thirst.Value local h = 100 local t = 100 local i = 0 repeat local x = math.random(10, 50) i = i + 0.0001 wait (x) Hunger = Hunger - 1 Hunger = Hunger - 1 until x == math.huge -------------------------------------------------- **If two people on the opposite sides of earth drop a piece of bread, the world briefly becomes a sandwich.** |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 05 Dec 2015 10:35 PM |
The variable is no longer connected to the value.
You have to change it to:
local Hunger = character.Hunger local Thirst = character.Thirst
Then you need to change the other section:
Hunger.Value = Hunger.Value - 1 Hunter.Value = Hunger - 1 -- although I assume you mean thirst? otherwise just do Hunger.Value - 2 the first time |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 05 Dec 2015 10:36 PM |
| That last line I wrote should be changed to "Hunger.Value = Hunger.Value - 1" (unless you actually meant thirst) |
|
|
| Report Abuse |
|
|
Aethex
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 2193 |
|
|
| 05 Dec 2015 10:39 PM |
I would also recommend using the Changed event rather than an infinite loop to save efficiency.
http://wiki.roblox.com/index.php?title=API:Class/IntValue/Changed
Even if you didn't plan on doing that, you know that you also made your loop strangely? The repeat loop works until something is true, waiting until a number is equal to math.huge is pointless. Instead, just do "repeat CODE until false" because it will never end. That's only if you have to, though. It is recommended to use my first method. |
|
|
| Report Abuse |
|
|
|
| 05 Dec 2015 11:11 PM |
I'm RPGMakerzz on a different account.
THANK YOU! :)
**If two people on the opposite sides of earth drop a piece of bread, the world briefly becomes a sandwich.** |
|
|
| Report Abuse |
|
|