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: Gui text not updating

Previous Thread :: Next Thread 
Sinblade is not online. Sinblade
Joined: 14 Aug 2010
Total Posts: 2782
04 Aug 2014 06:15 PM
while true do
local players = game.Players.NumPlayers
local Gui = game.StarterGui.TopBar.Frame.Text
if players < 2 then
print("Need 2 players to start")
Gui.Text = "Need 2 players to start"
end
if players >= 2 then
Gui.Text = "Starting in 10 seconds"
wait(1)
Gui.Text = "Starting in 9 seconds"
wait(1)
Gui.Text = "Starting in 8 seconds"
wait(1)
Gui.Text = "Starting in 7 seconds"
wait(1)
Gui.Text = "Starting in 6 seconds"
wait(1)
Gui.Text = "Starting in 5 seconds"
wait(1)
Gui.Text = "Starting in 4 seconds"
wait(1)
Gui.Text = "Starting in 3 seconds"
wait(1)
Gui.Text = "Starting in 2 seconds"
wait(1)
Gui.Text = "Starting in 1 seconds"
wait(1)
Gui.Text = "Game is starting"
end
wait(1)
end

When I look through my server's screen I see it working, but when I look through my players screen it won't work? ( The second if statement )
Report Abuse
sbk28 is not online. sbk28
Joined: 15 Nov 2008
Total Posts: 2528
04 Aug 2014 06:18 PM
while true do
local players = game.Players.NumPlayers
if players < 2 then
print("Need 2 players to start")
Gui.Text = "Need 2 players to start"
else
if players >= 2 then
for i, v in pairs(game.Players:GetChildren()) do
coroutine.wrap(
function()
for y = 10, 1, -1 do
wait(1)
v.PlayerGui.TopBar.Frame.Text.Text = "Starting in "..y.." seconds."
end
wait(1)
v.PlayerGui.TopBar.Frame.Text.Text = "Game is starting"
end)
end
wait(11)
end
wait(1)
end
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
04 Aug 2014 06:19 PM
local players = game.Players.NumPlayers
local Gui = game.StarterGui.TopBar.Frame
if players < 2 then
print("Need 2 players to start")
Gui.Text = "Need 2 players to start"
else
for i = 10, 0, -1 do
Gui.Text = "Starting in "..i
wait(1);
end
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
04 Aug 2014 06:19 PM
I forgot an end.
Report Abuse
sbk28 is not online. sbk28
Joined: 15 Nov 2008
Total Posts: 2528
04 Aug 2014 06:20 PM
@Acc he's moving it inside the startergui not inside the players that's the whole issue
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
04 Aug 2014 06:29 PM
Players have their own PlayerGui.
Open up explorer on play solo to see how it works.
You'd wanna look through players changing it
Report Abuse
Sinblade is not online. Sinblade
Joined: 14 Aug 2010
Total Posts: 2782
04 Aug 2014 06:30 PM
Oh, I see that they have their own GUI now, so how would I go about changing that?
Report Abuse
sbk28 is not online. sbk28
Joined: 15 Nov 2008
Total Posts: 2528
04 Aug 2014 06:31 PM
in my script i loop through the players and change each of their guis individually
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
04 Aug 2014 06:32 PM
for k,v in pairs(game.Players:children()) do
if v:findFirstChild("PlayerGui") then
v.PlayerGui.ScreenGui.TopBar.Text = "something"
end
end
Report Abuse
Sinblade is not online. Sinblade
Joined: 14 Aug 2010
Total Posts: 2782
04 Aug 2014 06:44 PM
Both of yours won't work for some reason .-. I deleted all of my script for yours but for Smileys I edited it to this after my second if and it isn't displaying.



for k,v in pairs(game.Players:children()) do
if v:findFirstChild("PlayerGui") then
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 10 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 9 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 8 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 7 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 6 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 5 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 4 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 3 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 2 seconds"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game will start in 1 second"
wait(1)
v.PlayerGui.ScreenGui.TopBar.Text = "Game is starting!"
wait(1)
end
end
Report Abuse
sbk28 is not online. sbk28
Joined: 15 Nov 2008
Total Posts: 2528
04 Aug 2014 06:47 PM
":GetPlayers()" not ":children()"
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
04 Aug 2014 07:09 PM
No :children() is fine. That's not the problem.

The problem is that script loops wrong. You want it like this:

--countdown loop
--loop through players updating GUIs
--end
--wait(1)
--end


You're doing:

--loop through players
--countdown

So each player has a separate countdown
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
04 Aug 2014 07:34 PM
@smiley

orly?


http://wiki.roblox.com/index.php?title=Children_(Method)
Report Abuse
smiley599 is not online. smiley599
Joined: 23 Jan 2010
Total Posts: 21869
04 Aug 2014 07:38 PM
It still works for me.
But thanks, I'll use GetChildren from now on
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
04 Aug 2014 07:44 PM
:children() works, it's just deprecated. I personally use GetChildren(), but GetPlayers() would definitely be the best option in this case.
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