Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Timer Things for different uses?

Asked by 10 years ago

I'm thinking of making multiple Timer things, and so that there would be a SurfaceGui and that the TextLabel's Text property would be equal to the Value in the Model called "Time" and then I would like say that every second that goes it takes away a second from the timer... I know that it's

wait(1)
Time.value = -1
wait(1)
Time.value = -1

but I don't know how to do the thing properly cos as you can see I did -1 but I seen that if a value is added then it's like

addvalue.TestValue = 1

or something like that, so I want to do mine to take away seconds, not add them, and then of course I know this one isn't from the Topic but, how do I get the Model's Position so that it could be used for something, like for example, use the Position to insert into NPC for the Destination, just like in some Zombie Games there are Chickens with C4 and then the Zombies go after them, but that's just an example, so thnx for listening and plz answer.

3 answers

Log in to vote
1
Answered by 10 years ago

It's just if you asy the Value is uqual to -1 it will be equal to this number, what you have to do is to say that your new value is equal to your old one -1. This script will help you. Also you can use loops so you dont have to write the same code over and over again. And remember to pinpoint yout "Time" so it leads to that value.

for i = 1, 60 do -- or as much as you like
    wait(1)
    Time.Value = Time.Value -1
end
0
I was typing my answer right when you posted yours. OniiCh_n 410 — 10y
0
is the 1, 60 says how many seconds to wait? kapitanovaskapandr 0 — 10y
0
1 is the starting point, 60 would be the end. There should be another value for increments, but I believe it averages to 0. It would repeat the same code continuously until i = 60 OniiCh_n 410 — 10y
Ad
Log in to vote
0
Answered by
OniiCh_n 410 Moderation Voter
10 years ago

Use a for loop!

for i = 0, 10, 1 then --If it's a countdown, swap 0 and 10, and change the 1 to -1; you are free to change the end value (middle value) if you want to make it longer/shorter.
       Time.value = i
       wait(1)
end
0
what are those 3 numbers for? kapitanovaskapandr 0 — 10y
Log in to vote
0
Answered by 10 years ago

By the way guys, am also planning to make a thing that would start countdown OnClicked, so it's like a Tool and so you click to drop it, and then the countdown starts, and also I want the Time to be fully in control cos I want the person to be able to set their own time...

Answer this question