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
 

GUI Countdown not working..

Previous Thread :: Next Thread 
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
09 Aug 2012 08:39 PM
Why?


text = game.StarterGui.Time.Frame.Main

while true do
text.Text = "Waiting for round..."
text.FontSize = "Size18"
wait(50)
text.Text = "5..."
text.FontSize = "Size24"
wait(1)
text.Text = "4..."
wait(1)
text.Text = "3..."
wait(1)
text.Text = "2..."
wait(1)
text.Text = "1..."
wait(1)
text.Text = "Begin!"
wait(5)
end
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:40 PM
You have to update every player's GUI AND the starter GUI.

If you just update the starter GUI, players will only see it when they respawn (because they start with the new one)
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
09 Aug 2012 08:41 PM
wait(50)
Are you actually waiting 50 seconds?

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
09 Aug 2012 08:41 PM
Oh so it would be:

text = game.PlayerGui.Time.Frame.Main ----PLayer GUI Right?

while true do
text.Text = "Waiting for round..."
text.FontSize = "Size18"
wait(50)
text.Text = "5..."
text.FontSize = "Size24"
wait(1)
text.Text = "4..."
wait(1)
text.Text = "3..."
wait(1)
text.Text = "2..."
wait(1)
text.Text = "1..."
wait(1)
text.Text = "Begin!"
wait(5)
end
Report Abuse
zankonator1 is not online. zankonator1
Joined: 27 Jun 2009
Total Posts: 1758
09 Aug 2012 08:43 PM
Lol. use a for loop

text = game.StarterGui.Time.Frame.Main

for time = 5, 0, -1, do
if time < 1 then
text.Text = "Begin!"
wait(5)
else
text.Text = tostring(time)
wait(1)
end
end

^^^ Should work
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 08:43 PM
Each player has their own player gui

i.e.

game.Players.DrAgonmoray.PlayerGui.Time.Frame.Main


You'll have to loop through every player and update their GUI, like so:

function updateGUI(text)
game.StarterGui.Time.Frame.Main.Text = text
for _, v in pairs(game.Players:GetChildren()) do
v.PlayerGui.Time.Frame.Main.Text = text
end
end

And when you want to change the text, do this:

updateGUI("Waiting for round...")
Report Abuse
zankonator1 is not online. zankonator1
Joined: 27 Jun 2009
Total Posts: 1758
09 Aug 2012 08:44 PM
text = game.StarterGui.Time.Frame.Main
text2 = script.Parent

for time = 5, 0, -1, do
if time < 1 then
text.Text = "Begin!"
text2.Text = "Begin!"
wait(5)
else
text.Text = tostring(time)
text2.Text = tostring(time)
wait(1)
end
end
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
09 Aug 2012 08:45 PM
@Swim

I am waiting 50 seconds
Report Abuse
moryo7 is not online. moryo7
Joined: 19 Jul 2010
Total Posts: 5028
09 Aug 2012 08:49 PM
Wait(50) isn't the same as waiting 50 seconds. It'll be off-key. But if you don't mind, stick with it.


-> This Siggy is My Little Pony based. <-
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
09 Aug 2012 09:19 PM
@moryo7 - What are you talking about? Off-key? There's no way he can get it to wait exactly 50 seconds, because ROBLOX's frame-rate is 0.03 seconds. If you do `wait(2)`, it's not going to wait EXACTLY 2 seconds. Just a bit above that. I used the tick() function, and by waiting 50 seconds, it will wait for approximately 50.013351678848 seconds. I believe that's perfectly fine.

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
09 Aug 2012 09:21 PM
@moryo

print(wait(50))
*50 seconds later*

50.003969704553

After wait(50), it's only a bit more than one seventh of a frame behind. Which basically means it's very nearly exactly 50 seconds.

-[::ƧѡÎḾḠΰῩ::]-[::Maker of stuff and Helper of Scripting::]-
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
09 Aug 2012 09:25 PM
@swimguy777 - Would you like some jelly with that latetoast? :P

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
DrAgonmoray is not online. DrAgonmoray
Joined: 29 Jul 2008
Total Posts: 17428
09 Aug 2012 09:55 PM
Neither of you guys accounted for lag that slows the framerate down.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
09 Aug 2012 10:00 PM
@DrAgon - That's relative. Some games have more lag than others.

http://wiki.roblox.com/index.php/User:ElectricBlaze
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
10 Aug 2012 10:09 AM
Why won't this one work?


text = game.Players.PlayerGui.Time.Frame.Main

while true do
text.Text = "Waiting for round..."
text.FontSize = "Size18"
wait(50)
text.Text = "5..."
text.FontSize = "Size24"
wait(1)
text.Text = "4..."
wait(1)
text.Text = "3..."
wait(1)
text.Text = "2..."
wait(1)
text.Text = "1..."
wait(1)
text.Text = "Begin!"
wait(5)
end
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
10 Aug 2012 10:13 AM
text = game.Players.PlayerGui.Time.Frame.Main
That doesn't exist.

function updateTimeGui(text, size)
size = size or "Size24";
for _, p in pairs(game.Players:GetChildren()) do
p.PlayerGui.Time.Frame.Main.Text = text;
p.PlayerGui.Time.Frame.Main.FontSize = size;
end
end

while true do
updateTimeGui("Waiting for round...", "Size18");
wait(50);
for i = 5, 1, -1 do
updateTimeGui(tostring(i).."...");
wait(1);
end
updateTimeGui("Begin!");
wait(5);
end
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
10 Aug 2012 10:27 AM
Ok thanks but how would I make it remove the GUI after the coundown and wait lets say 180 sconds before it reappears?
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
10 Aug 2012 10:28 AM
for _, p in pairs(game.Players:GetChildren()) do
p.PlayerGui.Time.Visible = false;
end
wait(180);
for _, p in pairs(game.Players:GetChildren()) do
p.PlayerGui.Time.Visible = true;
end

?
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
10 Aug 2012 10:30 AM
Thanks dr1od you helped me with like all the scripts I posted ha. and where would I pu this in the script at the end right?
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
10 Aug 2012 10:31 AM
Yeah, before the last end :3

Yw ^0^0^0^ <- lolwutface
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
10 Aug 2012 10:33 AM
function updateTimeGui(text, size)
size = size or "Size18";
for _, p in pairs(game.Players:GetChildren()) do
p.PlayerGui.Time.Frame.Main.Text = text;
p.PlayerGui.Time.Frame.Main.FontSize = size;
end
end

while true do
updateTimeGui("Waiting for round...", "Size18");
wait(10);
for i = 5, 1, -1 do
updateTimeGui(tostring(i).."...");
wait(1);
end
updateTimeGui("Begin!");
wait(5);
for _, p in pairs(game.Players:GetChildren()) do
p.PlayerGui.Time.Visible = false;
end
wait(180);
for _, p in pairs(game.Players:GetChildren()) do
p.PlayerGui.Time.Visible = true;
end
end
Report Abuse
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
10 Aug 2012 10:39 AM
How would size = size or "Size18" work? Size will always equal size. That's like:

print(nil = nil or "lolwut?")
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
10 Aug 2012 10:47 AM
..
My explanation post keeps getting blocked, but that does work.
Report Abuse
Stripeyman879 is not online. Stripeyman879
Joined: 31 Jul 2008
Total Posts: 1726
10 Aug 2012 11:01 AM
For some reason, the GUI is stuck on the Begin text and is not disappearing.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
10 Aug 2012 11:02 AM
Change Time.Visible = false/true to Time.Frame.Visible = false/true.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 2Go to page: [1], 2 Next
 
 
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