Hello, I was wondering if there was an easy way to make it so when a player clicks a button it changes the time of day?
COMMUNITY QUESTION
Change Time of Day using a Button?
1 answer
This is easy
Requirements: UI Button
Add a server script into the button
add this script into it
local timeOfDay = game.Lighting.TimeOfDay
local IsNight = false
script.Parent.MouseButton1Click:Connect(function()
if IsNight == false then
IsNight = true
timeOfDay = 0
else
IsNight = true
timeOfDay = 14
end
end)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
You can either change it locally, or globally (replicate to all other connected Clients). All you have to do is adjust the 'ClockTime' property of lighting upon a 'MouseButton1Click' signal fire from your GUIButton. Or alternatively, set up a RemoteEvent Instance in ReplicatedStorage, and have the Server adjust the time.
Thank you!