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

Is there a way to change text when it reaches a certain TimeofDay?

Asked by 4 years ago
Edited by theking48989987 4 years ago
if game.Lighting.TimeOfDay== ("14:00:00") then
    game.StarterGui.yet.TextBox2.Text = ("Free Time")
end

is what i typed, and it says it works, but nothing happens when that time is reached.

0
Have you made sure the time of day is changing? laggydude 0 — 4y
0
yes XxAgarioHeroxX338455 5 — 4y

1 answer

Log in to vote
0
Answered by
megukoo 877 Moderation Voter
4 years ago

Are you using an event to detect change? If not, here's an example of how you can detect if the TimeOfDay is changing.

local Lighting = game:GetService("Lighting")

Lighting:GetPropertyChangedSignal("TimeOfDay"):Connect(function()
    print(Lighting.TimeOfDay)
    -- the code inside here will run any time Lighting.TimeOfDay changes, allowing you to do
    if Lighting.TimeOfDay == "14:00:00" then
        print("free time")
    end
end)
Ad

Answer this question