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: Idk if it's actually possible.

Previous Thread :: Next Thread 
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 09:57 AM
Well, I have never done countdown scripts and I've gotten really far. Now I figured out an easy way to get the time in minutes and seconds.... On a calculator. But if you try it, Take the time (ex. 599 sec) divide it by 600 (10 min.) you get a number (min.) and a decimal, separate that decimal and do 60/[The Decimal] and you've got your seconds.

Yeah, crazy way, and if there's an easier way to do it I bet, but i'm too slow (mentally and physically) to figure it out.

My only question to doing this is, is there any way to separate the decimal in a script and use it in the equation?
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 09:58 AM
totally messed up. ^.^ divide it by 60 (1 min.)
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 10:00 AM
Yeah, and it'd be 60*[The Decimal]
Report Abuse
C0D3Y is not online. C0D3Y
Joined: 24 Jul 2010
Total Posts: 1692
18 Jun 2012 10:04 AM
Yes, do secs%60 and it will give you the seconds.
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 10:07 AM
Wait what?
Report Abuse
C0D3Y is not online. C0D3Y
Joined: 24 Jul 2010
Total Posts: 1692
18 Jun 2012 10:18 AM
Okay, say you have 125 seconds. You take the seconds, divide it by 60 and get 2 which is the minutes. Then, you take the seconds, use the modulus sign to get the remainder(%) and get 5. So you have 2 minutes 5 seconds which is equivalent to 125 seconds.
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 10:38 AM
Oh ok, thanks
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 10:45 AM
Ok, Im apparently stupid. Could you put it in equation form please?
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
18 Jun 2012 11:20 AM
Using the modulus operator (%)...

local seconds=120

local minutes=(seconds/60)%60 -->2
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 12:13 PM
Yeah, well the script didn't go very well. The % did nothing to help the script. It still stayed in it's decimal state...




while true do
seconds=game.Workspace.Time.Value
minutes=(seconds/60)%60
script.Parent.Text=minutes
wait(0.9966)
end
Report Abuse
Spectrumw is not online. Spectrumw
Joined: 04 Aug 2009
Total Posts: 13510
18 Jun 2012 12:18 PM
Time = #####
Minutes, Seconds = math.floor(Time/60 + .5), 60/(Time%60)
print(Minutes, Seconds)


Maybe?
Report Abuse
RawrBot is not online. RawrBot
Joined: 22 Aug 2008
Total Posts: 832
18 Jun 2012 12:19 PM
x, y = math.modf(2.5)

print(x)
>2
print(y)
>0.5
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
18 Jun 2012 12:27 PM
local minutes = game.Workspace.Minutes (IntValue)
local seconds = game.Workspace.Seconds (IntValue)
seconds.Value = 60
for i=1, 60 do
seconds.Value = seconds.Value -1
wait(1)
end
if seconds.Value == 0 then
seconds.Value = 60
minutes.Value = minutes.Value -1

(If you want it in a gui then)

for obj,gui in pairs(game.Players.LocalPlayer.PlayerGui.Hint:GetChildren()) do (I call my guis 'hint')

gui.Text = (minutes.Value.."minutes and"..seconds.Value.."seconds!")
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
18 Jun 2012 12:28 PM
end
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 12:38 PM
Mamaguy, I've already got the time set, it putting its into the gui is what im doing... >.>

And i'll try the 2 above.
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
18 Jun 2012 12:48 PM
Guis made simple = concatenation

gui.Text = (minutes.Value.."minutes and"..seconds.Value.."seconds!")
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 12:50 PM
You don't seem to look at the script I posted, work from there.... Spectrum your the closest to it! You've got the minutes correct, thank you, and I'm fidgeting with the seconds, for which I really getting close to.
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
18 Jun 2012 12:52 PM
Noob, you're trying to find the hardest way to put minutes and seconds into a gui? Pointless.
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 12:54 PM
I'm trying to do it a correct and efficient way. I've made more sense out of that then what your posting. And i'm just saying.
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
18 Jun 2012 12:57 PM
Okay, my way does work, now if you mean you want to count seconds and not intvalues that's what wait(1) is for.
My way is a lot more understandable than math.floor.
If you don't understand concatenation it's like this:
butter+fly
butterfly
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 01:01 PM
Yes it may work, but after I've gotten this far, mine works better...



while true do
Time = game.Workspace.Time.Value
Minutes, Seconds = math.floor(Time/60), 1*(Time%60)
print(Minutes, Seconds)
script.Parent.Text = Minutes.." Min. "..Seconds.." Sec."
wait(0.9966)
end
Report Abuse
Profucious is not online. Profucious
Joined: 28 May 2012
Total Posts: 6087
18 Jun 2012 01:02 PM
Clockmen, for they will!
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
18 Jun 2012 01:04 PM
Noob, it's stupid how you're just trying to find the absolute hardest way to countdown times. Mine is simple and easy, none of that math.floor stuff.
Report Abuse
noobkiller878 is not online. noobkiller878
Joined: 22 Dec 2008
Total Posts: 1465
18 Jun 2012 01:07 PM
Well not necessarily stupid if you understand it. Math.floor is here for a reason. I credit you on trying to help, but calling me stupid by figuring out my own problem with others help is no stupid matter by no means at all. I've figured it out and therefore I am done with this topic.
Report Abuse
mamaguy is not online. mamaguy
Joined: 07 Oct 2010
Total Posts: 7073
18 Jun 2012 01:08 PM
Obviously I wasn't calling you stupid, I was saying that you were trying to find the hardest way and that was stupid.
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