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

Simple script to make a part visible at a specific time of day will not work?

Asked by 3 years ago

I do not know how it is unable to operate, but here is what it is supposed to do.

An invisible brick in the workspace has a script inside of it that will make it visible at 18:00:00, but it will not work, I have a fair feeling that the day/night script in the workspace is preventing it from operating, but here is the script.

if game.Lighting.ClockTime == 18 then
    script.Parent.Transparency = 0
elseif
    game.Lighting.ClockTime == 8 then
    script.Parent.Transparency = 1

end

Simple script, although I cannot come up with any solutions.

1 answer

Log in to vote
1
Answered by
zadobyte 692 Moderation Voter
3 years ago

You should be checking every time the clocktime changes using GetPropertyChangedSignal, in which case, the script should look something like:

Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function() -- "ClockTime" can be exchanged for any property and this function exists for any object with a property.
    if ClockTime == time then

    elseif  then

    end
end)
Ad

Answer this question