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 » Scripting Helpers
Home Search
 

Re: wait()

Previous Thread :: Next Thread 
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
04 Aug 2014 11:30 PM
Anyone?
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
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
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
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 is not online. 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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
05 Aug 2014 12:19 AM
indexed "warp" as a nil value?
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
05 Aug 2014 12:20 AM
Type, it should be .wrap

Sorry
Report Abuse
iiEssence is not online. iiEssence
Joined: 18 Jun 2014
Total Posts: 3467
05 Aug 2014 12:20 AM
Typo***
Report Abuse
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
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 is not online. 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
peoplemove12 is not online. peoplemove12
Joined: 11 Feb 2010
Total Posts: 1442
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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