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

Enable global shadows at an especific hour?

Asked by 6 years ago

I want to disable global shadows at night and enable it at the morning.

while true do
end
wait()
    if game.Lighting.TimeOfDay == "06:30:00"
    then end
    game.Lighting.GlobalShadows = true

    if game.Lighting.ClockTime == "18:00:00"
    then
    game.Lighting.GlobalShadows = false

end
0
What is game.Lighting.GlobalShadows? A value? Leamir 3138 — 6y
0
This... oh man. This will never work. User#21908 42 — 6y
0
You have an infinite loop before the code. Not only will your code never reach the first if statement, it will also crash your game. User#21908 42 — 6y
2
This website does require you to post the code that you have tried. However, that does not mean putting some random stuff together. User#21908 42 — 6y
0
eh, I wouldn't really use TimeOfDay, i'd rather use ClockTime greatneil80 2647 — 6y

2 answers

Log in to vote
0
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Hello, TheLondiux!

I've found lots of errors on your script:

1 - Use end to close a block of code, like a while, if, or any other code blocks that you need to close

2 - You don't need to place the then on the next line, it just makes your code harder to read

3 - If the object at game.Lighting.TimeOfDay is a value, you should add a .Value to gets it's value...

while true do -- Loop Starts here
    wait()
    if game.Lighting.TimeOfDay == 06.5 then -- 6:30 -- First IF starts here
        game.Lighting.GlobalShadows = true
    end -- First IF ends here

    if game.Lighting.ClockTime == 18 then -- 18 -- Second IF starts here
        game.Lighting.GlobalShadows = false
    end -- Second IF ends here
end -- Loop ends here

Also, Scripting Helpers is not a place where you place a random script and we give you the answer, please post something that make sense with the question

Hope this helps

Good Luck with your games

0
mmmmm. Isn't working TheLondiux 11 — 6y
Ad
Log in to vote
-4
Answered by 6 years ago

Is this what you want to do?

Im new to scripting but here you go

while wait(1) do
    warn("OKASD")
    if game.Lighting.TimeOfDay == 6.5 then --"06:30:00"
        game.Lighting.GlobalShadows = true
        print("GlobShadows On")
    elseif game.Lighting.ClockTime == 18 then --"18:00:00"
        game.Lighting.GlobalShadows = false
        print("GlobShadows Off")
    end
end

You can delete the (print) lines thats for when you add your time system i am guessing

0
Don't give him the code, explain what you're doing Leamir 3138 — 6y
0
aww man -3 aleandroblingo -35 — 6y

Answer this question