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

I want to make a roblox day and night Cycle but is not working, i code the scrip on workspace?

Asked by 6 years ago

while true do lightning:SetMinutesAfterMidnight(lightning:GetMinutesAfterMidnight() + 0.75) wait(1) end

2 answers

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Hi, TheVlogingAustin_YT. I will be helping you regarding the question, I want to make a roblox day and night Cycle but is not working, i code the scrip on workspace?

1) Yes, you do put the script into the workspace.

2) You haven't increased the value yet.

-- Declaration Section 

local getMinutesAfterLighting = 0

-- Processing Section 

while true do
    getMinutesAfterLighting = getMinutesAfterLighting + 0.75
    game.Lighting:SetMinutesAfterMidnight(getMinutesAfterLighting)
    wait(.1)
end 
Have a lovely day of coding!
Ad
Log in to vote
0
Answered by 6 years ago

A much more efficient and easier way of doing this is to write this script here:

while true do
wait(1)
game.Lighting.ClockTime = game.Ligthing.ClockTime + 0.01
end

I think this method is becoming standard. But not only that, using ClockTime instead of accessing the time of day will allow more straightforward numeric operations, and it's also much, much easier to do conditional statements using ClockTime instead of TimeOfDay, and your code is cleaner as well!

It's also recommended to place scripts into the ServerScriptService, for security reasons (clients do not have access to ServerScriptService or ServerStorage.)

0
And you forgot to mention that he had written "lightning" like a flash in the sky during a storm rather than "lighting" like light. kazeks123 195 — 6y
0
I hadn't caught onto that. TheRings0fSaturn 28 — 6y
0
Good eye, though! TheRings0fSaturn 28 — 6y

Answer this question