|
| 11 Apr 2016 08:28 PM |
I have a script that keeps changing the text to a random weapon name. I now added this script that should change the color of the text is a certain weapon. But it stays the same color the whole time?
local Text = script.Parent.Text while wait() do if Text == "M1911" or Text == "Auto Glock" or Text == "K5" then script.Parent.TextColor3 = Color3.new(255, 255, 255) end end
- hi add 3k to post count |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 11 Apr 2016 08:30 PM |
You're only changing to one color?
And I believe Color3 is on a 0-1 scale |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2016 08:33 PM |
Yes, my textlabel's text is red, and the text changes to mutiple names (including these names). But when they come up, the text stays red, and not white.
- hi add 3k to post count |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
| |
|
|
| 11 Apr 2016 08:58 PM |
| Why is scripting so difficult? Even when we get it right it still don't work |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 11 Apr 2016 09:20 PM |
Text.Changed:connect(function() if Text == "Write" or Text == "Code" or Text == "Here" then script.Parent.TextColor3 = Color3.new(255/255,255/255,255/255) end end)
sry if I messed up somewhere wrote this on mobile |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 11 Apr 2016 09:21 PM |
| Basically the same as 1 I guess |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2016 09:23 PM |
error: attempt to index field 'Changed' (a nil value)
- hi add 3k to post count |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 11 Apr 2016 09:25 PM |
umm just use while wait() do for now imma sleep |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2016 09:25 PM |
But it doesnt work
- hi add 3k to post count |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
|
| 11 Apr 2016 09:28 PM |
| Hmm that's weird. Try's using prints everywhere and find out where it stops. Then if you still don't get it you try searching that specific part like, "Why is my text color changing roblox" or something like that . Anyway I gtg |
|
|
| Report Abuse |
|
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 11 Apr 2016 09:28 PM |
The reason why is you are physically setting the variable to the property of the Text, so if the Text was 'Hello' and it changed the variable will stay the same.
Fixed code: local Text = script.Parent while wait() do if Text.Text == "M1911" or Text.Text == "Auto Glock" or Text.Text == "K5" then script.Parent.TextColor3 = Color3.new(255, 255, 255) end end |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2016 09:28 PM |
Fixed the Changed error, still didnt change the colors text
- hi add 3k to post count |
|
|
| Report Abuse |
|
|
eRanged
|
  |
| Joined: 15 Jun 2013 |
| Total Posts: 9746 |
|
| |
|
|
| 11 Apr 2016 09:29 PM |
@Ty It worked, thank you.
@everyone else thanks for trying
- hi add 3k to post count |
|
|
| Report Abuse |
|
|