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

I have a live event for a game. Why won't it start at the given UTC time?

Asked by 4 years ago

Here's my script for the time of the event.

local EventTime = os.time({year=2020; month=4 ; day=12; hour=18; min=20})-- <-- UTC time.
local MainModule = require(script.Parent.Actions)

while true do
    local SecondsBetween = os.difftime(EventTime,os.time())
    local SecsTill = SecondsBetween%60
    local MinutesTill = math.floor(SecondsBetween%3600/60)
    local HoursTill = math.floor(SecondsBetween%86400/3600)
    local DaysTill = math.floor(SecondsBetween%(86400*30)/86400)
    if SecondsBetween <= 0 and SecondsBetween >= -2 then
        break
        end
    wait()
end

Here's my live event actions ModuleScript

local module = {}

module.Main = function()
    workspace.Sound:Stop()
    local g = Instance.new("Hint",workspace)
            g.Text = "NUCLEAR EXPLOSION IMMINENT! BRACE FOR DESTRUCTION!"
    wait(3)
            g.Text = "The Town of Overboard City will be destroyed in 10 seconds."
    wait(5)
            g.Text = "The Town of Overboard City will be destroyed in 5 seconds."
    wait(1)
            g.Text = "The Town of Overboard City will be destroyed in 4 seconds."
    wait(1)
            g.Text = "The Town of Overboard City will be destroyed in 3 seconds."
    wait(1)
            g.Text = "The Town of Overboard City will be destroyed in 2 seconds."
    wait(1)
            g.Text = "The Town of Overboard City will be destroyed in 1 seconds."
    wait(1)
            g:Destroy()

    workspace.Gate.Voice.Disabled = false
    workspace.Orb:Destroy()
    wait(4)
    workspace.Town:Destroy()
    workspace.SurfaceGuiTest:Destroy()

    game.Lighting.Ambient = Color3(255, 000, 000)
    game.Lighting.OutdoorAmbient = Color3(255, 000, 000)
end

return module

Can somebody show me what's wrong with these scripts?

1 answer

Log in to vote
0
Answered by 4 years ago

Problems

You forgot 1 line of code. You didn't Call the Main function when the loop breaks

Solution

Add

MainModule.Main()

at the end of the script

0
Luka, which script do I put "MainModule.Main()" in Not_TheOnlyTree 11 — 4y
0
the first one Luka_Gaming07 534 — 4y
0
ok Not_TheOnlyTree 11 — 4y
0
if it worked please accept the answeer Luka_Gaming07 534 — 4y
View all comments (3 more)
0
It works in studio, but not a real game of it. Not_TheOnlyTree 11 — 4y
0
its probably because hints are deprecated Luka_Gaming07 534 — 4y
0
Hints still work in the client Lord_WitherAlt 206 — 4y
Ad

Answer this question