|
| 04 Aug 2014 10:36 PM |
How could I make the text clear without using "wait()"?
local ExperiencePLAYER = script.Parent.Parent.Parent.Parent.Parent.ExperiencePLAYER
Old = ExperiencePLAYER.Value ExperiencePLAYER.Changed:connect(function() Difference = ExperiencePLAYER.Value - Old if Difference > 0 then script.Parent.Text = "+"..Difference else script.Parent.Text = Difference end Old = ExperiencePLAYER.Value end) |
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Aug 2014 11:43 PM |
local ExperiencePLAYER = script.Parent.Parent.Parent.Parent.Parent.ExperiencePLAYER
Old = ExperiencePLAYER ExperiencePLAYER.Changed:connect(function(New) Difference = New - Old if Difference > 0 then script.Parent.Text = "+"..Difference else script.Parent.Text = Difference end Old = New end)
|
|
|
| Report Abuse |
|
|
|
| 04 Aug 2014 11:46 PM |
if this doesn't work, try the one I posted above
local ExperiencePLAYER = script.Parent.Parent.Parent.Parent.Parent.ExperiencePLAYER
Old = ExperiencePLAYER ExperiencePLAYER.Changed:connect(function(New) Difference = New - Old.Vlue if Difference > 0 then script.Parent.Text = "+"..Difference else script.Parent.Text = Difference end Old.Value = New end)
|
|
|
| Report Abuse |
|
|
|
| 05 Aug 2014 12:13 AM |
| None of those worked. The first one did nothing. The second one just popped up as 0. Anything else? Or is their something your missing? |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
|
| 05 Aug 2014 12:16 AM |
Assuming you don't want wait, because you want them to gain experience without waits. That's where coroutines come into play:
Old = ExperiencePLAYER.Value ExperiencePLAYER.Changed:connect(function() Difference = ExperiencePLAYER.Value - Old if Difference > 0 then script.Parent.Text = "+"..Difference else script.Parent.Text = Difference end coroutine.warp(function() wait(1) script.Parent.Text = "" end)() Old = ExperiencePLAYER.Value end) |
|
|
| Report Abuse |
|
|
|
| 05 Aug 2014 12:19 AM |
| indexed "warp" as a nil value? |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
|
| 05 Aug 2014 12:20 AM |
Type, it should be .wrap
Sorry |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
| |
|
|
| 05 Aug 2014 12:33 AM |
| Is their any way to make this more efficient? For example, I noticed that this code works fine. Thank you for that but, I want it to work right on. Like the player gets 50 xp then 60 then 65 and so on like a streak... then the text clears. Not like 50 then it waits and it does not show the 50, 60, and 65. If you could help me with this that would be great. Thanks so much by the way. |
|
|
| Report Abuse |
|
|
iiEssence
|
  |
| Joined: 18 Jun 2014 |
| Total Posts: 3467 |
|
|
| 06 Aug 2014 06:52 PM |
Old = ExperiencePLAYER.Value ExperiencePLAYER.Changed:connect(function() Difference = ExperiencePLAYER.Value - Old if Difference > 0 then script.Parent.Text = "+"..Difference else script.Parent.Text = Difference end coroutine.warp(function() oldtxt = Difference wait(1) if Difference == oldtxt then script.Parent.Text = "" end end)() Old = ExperiencePLAYER.Value end)
That MIGHT do it, not sure. Test it out! |
|
|
| Report Abuse |
|
|
|
| 08 Aug 2014 03:29 PM |
That did not work. But this did, the only problem is whenever the experience is decreased it shows a plus sign. Any ideas?
Old = ExperiencePLAYER.Value ExperiencePLAYER.Changed:connect(function() Difference = ExperiencePLAYER.Value - Old if Difference > 0 then script.Parent.Text = "+"..Difference else script.Parent.Text = Difference end coroutine.wrap(function() wait(1) script.Parent.Text = "" end)() end) |
|
|
| Report Abuse |
|
|