nise45
|
  |
| Joined: 17 Nov 2008 |
| Total Posts: 7002 |
|
|
| 10 Sep 2013 12:33 PM |
player = game.Players.LocalPlayer text = script.Parent:WaitForChild("TextLabel") sound = script.Parent:WaitForChild("Tick")
local textFade = coroutine.wrap(function() for i=1,100 do text.TextTransparency = text.TextTransparency + 0.025 wait(0.05) end end)
local bgFade = coroutine.wrap(function() for i=1,40 do text.BackgroundTransparency = text.BackgroundTransparency + 0.01 wait(0.05) end end)
function onDied() text.Visible = true wait(1) text.Text = "4" sound:Play() wait(1) text.Text = "3" sound:Play() wait(0.5) bgFade() textFade() wait(0.5) text.Text = "2" sound:Play() wait(1) sound.Pitch = 2 sound:Play() text.Text = "1" end
player.Character:WaitForChild("Humanoid").Died:connect(onDied)
|
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 12:37 PM |
| Yes. Split it up into multiple for loops. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 12:38 PM |
As in
for i = 1, 15 do --0.5 seconds with wait() --stuffs wait() end --whatever for i = 1, 30 do --1 second with wait() --MORE STUFFS wait() end --EVEN MORE WHATEVER --OTHER STUFFS! |
|
|
| Report Abuse |
|
|
nise45
|
  |
| Joined: 17 Nov 2008 |
| Total Posts: 7002 |
|
|
| 10 Sep 2013 12:38 PM |
| Only one for loop can be ran at the same time... |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 12:39 PM |
| You dont NEED to run more, in your example! |
|
|
| Report Abuse |
|
|
nise45
|
  |
| Joined: 17 Nov 2008 |
| Total Posts: 7002 |
|
|
| 10 Sep 2013 12:40 PM |
| I do. I want the time to tick at the same time as the GUI fades... |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 12:41 PM |
Take this bit:
local textFade = coroutine.wrap(function() for i=1,100 do text.TextTransparency = text.TextTransparency + 0.025 wait(0.05) end end)
local bgFade = coroutine.wrap(function() for i=1,40 do text.BackgroundTransparency = text.BackgroundTransparency + 0.01 wait(0.05) end end)
----------------------------------------------------------------------------
bgFade() textFade() wait(0.5) text.Text = "2" sound:Play() wait(1) sound.Pitch = 2 sound:Play() text.Text = "1"
You can turn that into
for i = 1, 15 do text.BackgroundTransparency = text.BackgroundTransparency + 0.01 text.TextTransparency = text.TextTransparency + 0.025 wait() end text.Text = "2" sound:Play() for i = 1, 25 do text.BackgroundTransparency = text.BackgroundTransparency + 0.01 text.TextTransparency = text.TextTransparency + 0.025 wait() end for i = 1, 5 do text.TextTransparency = text.TextTransparency + 0.025 wait() end sound.Pitch = 2 sound:Play() text.Text = "1"
Not as nice, but no coroutines. |
|
|
| Report Abuse |
|
|
nise45
|
  |
| Joined: 17 Nov 2008 |
| Total Posts: 7002 |
|
|
| 10 Sep 2013 12:43 PM |
| I'd rather have it with coroutines other than ruin it. I was just asking if it was possible or not to achieve the same effect. |
|
|
| Report Abuse |
|
|
| |
|
nise45
|
  |
| Joined: 17 Nov 2008 |
| Total Posts: 7002 |
|
|
| 10 Sep 2013 12:45 PM |
| It's not at all. The gui doesn't fade the same way but starts and stops. The timing is off too. I need it to take exactly 5 seconds. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 12:47 PM |
How does it start and stop, have you even tried it?
Although it DOES need this added to the end:
for i = 1, 55 do text.TextTransparency = text.TextTransparency + 0.025 wait() end |
|
|
| Report Abuse |
|
|
nise45
|
  |
| Joined: 17 Nov 2008 |
| Total Posts: 7002 |
|
|
| 10 Sep 2013 01:21 PM |
| Yes I tried. It's choppy and the timing is off. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 01:34 PM |
| But its like almost the same thing. How is it choppy..? |
|
|
| Report Abuse |
|
|
nise45
|
  |
| Joined: 17 Nov 2008 |
| Total Posts: 7002 |
|
|
| 10 Sep 2013 02:03 PM |
| Because it's not the same thing. The timing is off. |
|
|
| Report Abuse |
|
|
Xeptix
|
  |
| Joined: 14 Mar 2013 |
| Total Posts: 1115 |
|
|
| 10 Sep 2013 02:21 PM |
| nise... are you kidding me?... |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
nise45
|
  |
| Joined: 17 Nov 2008 |
| Total Posts: 7002 |
|
|
| 10 Sep 2013 03:25 PM |
Thanks for your response Oysi! The logic thing was never really a problem, but I should fix it for max efficiency. I agree. The thing is that the background for the GUI is already at 60 or so, so I did two of them so that the background and the text faded at (almost) the same rate. Would your solution fix that?
I love your stuff, by the way. c: |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 04:01 PM |
| @Oysi: If you read my code, you would see I fixed the issue with different loop lengths... |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
|
| 10 Sep 2013 04:07 PM |
| But how did I mess up the timing..? Explain. |
|
|
| Report Abuse |
|
|
Oysi
|
  |
| Joined: 06 Jul 2009 |
| Total Posts: 9058 |
|
| |
|
| |
|
|
| 10 Sep 2013 04:51 PM |
| Well, does RunService count as coroutines? Runservice, if statement and a disconnect. |
|
|
| Report Abuse |
|
|
|
| 10 Sep 2013 04:56 PM |
for i=1,100 do if i <= 40 then text.BackgroundTransparency = text.BackgroundTransparency + 0.01 end text.TextTransparency = text.TextTransparency + 0.025 wait(0.05) end
This _should_ work. Please don't rage if I made a simple or stupid mistake. |
|
|
| Report Abuse |
|
|