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: Time left script

Previous Thread :: Next Thread 
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 07:49 PM
The following script has no output and the countdown does not work. Any help.

----------------------------------------------------------------------------

while true do
wait(1) -- This one is for making sure the loop actually works, and the map loads.
-- Lets get to cloning! :D

game.Lighting.Mapchange.Map1:clone().Parent = game.Workspace -- Make a model named Mapchange and put it inside of Lighting. Inside of that, put your first map model and rename it to Map1

for i=10,1,-1 do --the countdown (for loop)

game.StarterGui.TimeGui.Clock.TextBox.Text = ""..i..""

wait(1)



end



wait(180) -- Time until the next map .

local m = Instance.new("Message") -- Creates a new message. But where? It could go anywhere! Lets check it out on the next line
m.Parent = game.Workspace -- Ok. Now we know that if m is equal to the message, we can use the Parent function thing to make the games Workspace the parent.
m.Text = "Loading: Map2" -- Using the Text thingy, we can change the text of the new message parented in workspace

game.Workspace.Map1:remove() -- removed map1


wait(180) -- Just a wait...
m:Remove() -- We removed the message from existence after 5 seconds.

end

---------------------------------------------------------------------

OUTPUT:

None!!!!

----------------------------------------------------------------------

It should work. Mapchanging works. I just need the


for i=10,1,-1 do --the countdown (for loop)

game.StarterGui.TimeGui.Clock.TextBox.Text = ""..i..""

wait(1)



end


--------------------------------------------------------------------------

To work. Whats wrong?? I have a TimeGui inside StarterGui. And inside TimeGui theres a Frame called Clock and inside that is a TextBox. Any help??
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 07:53 PM
Bump...
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
07 Oct 2011 07:58 PM
"wait(180) -- Just a wait...
m:Remove() -- We removed the message from existence after 5 seconds."

"180"
"5 seconds"

...youre kidding right

also, that part that doesnt work actually does work, its just that youre changing the wrong thing. you have to change the text of the guis in all the players playerguis.

for i,v in next, game.Players:GetPlayers() do -- iterate through all the players in your game
v.PlayerGui.Whatever.SomethingElse.Text = i -- dont really need the concatenation
end
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 08:00 PM
Hmmm..... Anyone who can also help a little to make it work smoother?
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 08:02 PM
Wait....In next? What? How do I change how many seconds it will countdown from???
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
07 Oct 2011 08:05 PM
this is how pairs works:

function pairs(t)
return next, t, nil
end

so basically, this

for i,v in pairs(x) do

is the same as this

for i,v in next, x do

k

and if you cant figure out how to change the seconds, then i doubt that you wrote that entire script :l
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 08:11 PM
I wrote it, just not the countdown. I always had trouble with countdowns. Can you provide a wiki link that will have a tutorial and explanation.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
07 Oct 2011 08:12 PM
see if this link works, i dont feel like getting it from the actual page

wiki.roblox.com/index.php/User:Crazypotato4/Test_2#For

if not, jut go to the page and scroll to the part on for loops

that should teach you what you need to know in order for it to work :l
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 08:19 PM
It helped me lern quite a bit. But i'm still trying to find the for i,v one. I got the For i,1,10 do one.
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
07 Oct 2011 08:20 PM
i havent gotten to that part yet D:

you can search 'generic for' on the wiki and there should be a page on the loop in question.
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 08:22 PM
Roblox wiki can be so unhelpful when it comes to generic for's. D: They wrote a sentence on it. It didnt really help. :( Can you rewrite my script in a way it would work? It would be very helpful. Thanks! :D
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 08:45 PM
Bump? I still need help you know....
Report Abuse
crazypotato4 is not online. crazypotato4
Joined: 22 Feb 2010
Total Posts: 20000
07 Oct 2011 08:48 PM
i searched for generic for, and got this page, which i find quite good on explaining the generic for loop

http://wiki.roblox.com/index.php/Generic_for
Report Abuse
dirk29 is not online. dirk29
Joined: 26 May 2010
Total Posts: 1142
07 Oct 2011 08:56 PM
while true do
wait(1) -- This one is for making sure the loop actually works, and the map loads.
-- Lets get to cloning! :D

game.Lighting.Mapchange.Map1:clone().Parent = game.Workspace -- Make a model named Mapchange and put it inside of Lighting. Inside of that, put your first map model and rename it to Map1

for i,v in pairs(game.Players:GetPLayers()) do
for i = 10,1,-1 do
v.PlayerGui.TimeGui.Clock.TextBox.Text = ""..i..""

wait(1)


end
end



wait(180) -- Time until the next map .

local m = Instance.new("Message") -- Creates a new message. But where? It could go anywhere! Lets check it out on the next line
m.Parent = game.Workspace -- Ok. Now we know that if m is equal to the message, we can use the Parent function thing to make the games Workspace the parent.
m.Text = "Loading: Map2" -- Using the Text thingy, we can change the text of the new message parented in workspace

game.Workspace.Map1:remove() -- removed map1


wait(180) -- Just a wait...
m:Remove() -- We removed the message from existence after 5 seconds.

end
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 09:35 PM
Thanks! Works like a charm!
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
07 Oct 2011 09:45 PM
Wait. Only works in test. In regular mode it just says TextBox (did not change text). Then it goes blank after 10 secs. Any idea? But, thanks for helping, it atleast gave me a start!
Report Abuse
dirk29 is not online. dirk29
Joined: 26 May 2010
Total Posts: 1142
08 Oct 2011 09:42 AM
while true do
wait(1) -- This one is for making sure the loop actually works, and the map loads.
-- Lets get to cloning! :D

game.Lighting.Mapchange.Map1:clone().Parent = game.Workspace -- Make a model named Mapchange and put it inside of Lighting. Inside of that, put your first map model and rename it to Map1

for i,v in pairs(game.Players:GetPlayers()) do
for i = 10,1,-1 do
v.PlayerGui.TimeGui.Clock.TextBox.Text = ""..i..""

wait(1)


end
end



wait(180) -- Time until the next map .

local m = Instance.new("Message") -- Creates a new message. But where? It could go anywhere! Lets check it out on the next line
m.Parent = game.Workspace -- Ok. Now we know that if m is equal to the message, we can use the Parent function thing to make the games Workspace the parent.
m.Text = "Loading: Map2" -- Using the Text thingy, we can change the text of the new message parented in workspace

game.Workspace.Map1:remove() -- removed map1


wait(180) -- Just a wait...
m:Remove() -- We removed the message from existence after 5 seconds.

end
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
08 Oct 2011 10:19 AM
Its the same thing but with Players instead of PLayers. I already tried that. It still is broken. :(
Report Abuse
dirk29 is not online. dirk29
Joined: 26 May 2010
Total Posts: 1142
08 Oct 2011 09:36 PM
Uhm ill try to contact one of my scripter friends for this.
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
09 Oct 2011 06:21 AM
Ok! Thanks dirk! Also, its a bit glitchey. Even in test. In test atleast the count down works, but when ever you left click (FOr guns, sword, walking...) it starts to flicker and it gets annoying...
Report Abuse
Shrimp1789 is not online. Shrimp1789
Joined: 01 Feb 2011
Total Posts: 1935
10 Oct 2011 07:33 PM
Ok now i relate to your problem as a minigame script.
ok so say its down to the last 10 secounds of a minigame and you want your users to know that so using this info and everything that uve customised ive made a personal script for you I shall pm it to u. It should work and all the maps you have need to be around he exact same size or you'll have some problems... and mad players. Hope it helps!

Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
21 Oct 2011 04:09 PM
Help? Can someone help make this work, teleport people to a waiting room, have a 30 second rest and the countidown in the waiting room, and it to show who is left from each round. And I need it if you die before the round is over, you have to wait until the next round.
Report Abuse
TheNewScripter is not online. TheNewScripter
Joined: 02 Mar 2010
Total Posts: 2432
21 Oct 2011 04:13 PM
for i=10,1,-1 do --the countdown (for loop)
game.StarterGui.TimeGui.Clock.TextBox.Text = ""..i..""
wait(1)
end


Replace this, with this

for i = 10, 1, -1 do

for _, player in pairs(Game:GetService("Players"):GetPlayers()) do
pcall(function() -- ignores errors
player.PlayerGui.TimeGui.Clock.TextBox.Text = i
end)
end

wait(1)

end
Report Abuse
skipperguy12 is not online. skipperguy12
Joined: 09 Oct 2009
Total Posts: 955
22 Oct 2011 05:55 PM
still flickers, and needs work.
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