generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Text Color Problem

Previous Thread :: Next Thread 
RPGMakerzz is not online. RPGMakerzz
Joined: 07 Jun 2014
Total Posts: 73
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
DoNotReadThisNamePlz is not online. DoNotReadThisNamePlz
Joined: 01 Aug 2014
Total Posts: 679
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 is not online. 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
RPGMakerzz is not online. RPGMakerzz
Joined: 07 Jun 2014
Total Posts: 73
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
RPGMakerzz is not online. RPGMakerzz
Joined: 07 Jun 2014
Total Posts: 73
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
DoNotReadThisNamePlz is not online. DoNotReadThisNamePlz
Joined: 01 Aug 2014
Total Posts: 679
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
RPGMakerzz is not online. RPGMakerzz
Joined: 07 Jun 2014
Total Posts: 73
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 is not online. 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
RPGMakerzz is not online. RPGMakerzz
Joined: 07 Jun 2014
Total Posts: 73
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 is not online. 62GB
Joined: 03 Oct 2011
Total Posts: 4157
05 Dec 2015 09:34 PM
:)
Report Abuse
RPGMakerzz is not online. RPGMakerzz
Joined: 07 Jun 2014
Total Posts: 73
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 is not online. 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 is not online. 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 is not online. 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
BetterScriptable is not online. BetterScriptable
Joined: 27 Nov 2015
Total Posts: 69
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image