Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I enable this script at a determined hour to make a live event?

Hello! I've got a script to make a live event. How can I change (or add another script to enable it at the event time) the script to start the event at 10/01/2020 at 19:00 CET? This is the script:

wait()
game.Lighting.TimeOfDay = 21
game.Workspace["Day and night"].Disabled = true
--If a nozzle does not appear, it means that only has one size.
	--Center speeds: 250,175,110
	--Inclined inside out speeds: 160,130,50
	--Inclined out inside speeds: 115,100,80,50
	--Outskirts speeds: 75,37.5
	--Sorround speeds: 200,150,100,110,90
	--Normal jets speed: 75,100,125,150
wait(60)
game.Workspace.Music.Playing = true
wait()
script.Parent.TurnOnSpinning.Disabled = false
script.Parent.Nozzles.Center.Center.ParticleEmitter.Speed = NumberRange.new(175,175)
script.Parent.Nozzles.Center.Center.ParticleEmitter.Enabled = true
script.Parent.Lights.TurnCenterLightsOn.Script.Disabled = false
wait(14.72)
script.Parent.TurnOffSpinning.Disabled = false
script.Parent.Nozzles.NormalJets.Group1.NormalJet1.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group1.NormalJet2.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group1.NormalJet3.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group1.NormalJet4.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group1.NormalJet5.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group1.NormalJet6.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group1.NormalJet7.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group2.NormalJet1.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group2.NormalJet2.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group2.NormalJet3.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group2.NormalJet4.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group2.NormalJet5.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group2.NormalJet6.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group2.NormalJet7.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group3.NormalJet1.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group3.NormalJet2.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group3.NormalJet3.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group3.NormalJet4.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group3.NormalJet5.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group3.NormalJet6.ParticleEmitter.Speed = NumberRange.new(100,100)
script.Parent.Nozzles.NormalJets.Group3.NormalJet7.ParticleEmitter.Speed =
NumberRange.new(100,100)...

The script is too long so I did not insert it entirely.

2 answers

✓ Accepted answer

os.date can be used to get real life time.

Ex.

if os.date("!*t")[5] == 20 then
	print("it is the 20th")
end

This code will run only if it is the 20th of any month.

The first value ("!*t") is whether it is local ("*t") or UTC time ("!*t"), since you are doing a community event you would want to use UTC time. There is a second value but you wont need to use that here, check out this for more information on that.

All this does though is spit out a table, so we need to get a specific value out of it. The way you single out a value on a table is by enclosing the spot in the table of the value you want in square brackets.

Ex.

local Table = {variable1, variable2, variable3}

print(Table[2])

This will print the word variable2 because it is the second item in the Table we created.

For os.date the numbers are year [1], month [2], wday [3], yday [4], day [5], hour [6], min [7] and sec [8].

Completed it should look something like this.

Ex.

if os.date("!*t")[5] == 20 and os.date("!*t")[2] == 4 then
	print("it is the 20th of April")
end

2 comments

0

Ok, the script would enable the day 20 of the month 5 (may), but how can I set the hour and the year?

0

I added more to explain it better

So the code should be:

if os.date("!*t")[1] == 2020 and if os.date("!*t")[2] == 1 and if os.date("!*t")[3] == 2 and os.date("!*)[6] == 3 and os.date("!*t")[7] == 0 and os.date("!*t")[8] == 0 then
--script
end

This discussion is preserved as it was. New answers, comments, and votes are closed.