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 » Scripters
Home Search
 

Re: Timer?

Previous Thread :: Next Thread 
Aaroncy is online. Aaroncy
Joined: 15 Nov 2012
Total Posts: 3552
16 Oct 2015 08:37 AM
im working on a timer for my game, then I want it to make a message who won the game...
Report Abuse
Faisal1207 is not online. Faisal1207
Joined: 27 Dec 2013
Total Posts: 499
16 Oct 2015 08:50 AM
Details, anyways for the timer.
You would have an gui that displays time i guess. For now lets assume it's name is Status, and that it is in StarterGui, and that we have an NumberValue named count in Replicated storage, an server script:

local repstore = game:WaitForChild("ReplicatedStorage")
local counter = repstore:WaitForChild("Counter")

counter.Value = 90 -- Time

while wait(1) do
for i,v in pairs(game.Players:GetPlayers()) do
counter.Value = counter.Value - 1
local gui = v.Playergui:WaitForChild("ScreenGui")
local status = gui:FindFirstChild("Status")
status.Text = "Mesagge here", counter.Value
end

Blindly scripter.



- "I say no because yes is overrated"
Report Abuse
Faisal1207 is not online. Faisal1207
Joined: 27 Dec 2013
Total Posts: 499
16 Oct 2015 08:51 AM
Blindly scripted*


- "I say no because yes is overrated"
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
16 Oct 2015 08:58 AM
And very inefficient
Report Abuse
Faisal1207 is not online. Faisal1207
Joined: 27 Dec 2013
Total Posts: 499
16 Oct 2015 09:00 AM
Well, how? I'm not too good at efficient scripts, any pin points?
Thanks!


- "I say no because yes is overrated"
Report Abuse
IllegallyBlind is not online. IllegallyBlind
Joined: 07 Nov 2010
Total Posts: 1691
16 Oct 2015 10:07 AM
dont use loops facedesk


i make u math.sqrt()
Report Abuse
Faisal1207 is not online. Faisal1207
Joined: 27 Dec 2013
Total Posts: 499
16 Oct 2015 10:30 AM
Numerical for loops instead? They are still loops but they are more efficient.

local repstore = game:WaitForChild("ReplicatedStorage")
local counter = repstore:WaitForChild("Counter")

counter.Value = 90 -- Time

while wait(1) do
for i,v in pairs(game.Players:GetPlayers()) do
repeat
counter.Value = counter.Value - 1
local gui = v.Playergui:WaitForChild("ScreenGui")
local status = gui:FindFirstChild("Status")
status.Text = "Mesagge here", counter.Value
until counter.Value = 0
end

Now it stops, better? Anyways don't just discount all loops, i guess forever looping loops are costy. But nontheless usefull for repeating, for example an round cyclus, or doing something until an condition is met. Don't quote me on this.


- "I say no because yes is overrated"
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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