Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Enable global shadows at an especific hour?

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

5 comments

0

What is game.Lighting.GlobalShadows? A value?

0

This... oh man. This will never work.

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.

2

This website does require you to post the code that you have tried. However, that does not mean putting some random stuff together.

0

eh, I wouldn't really use TimeOfDay, i'd rather use ClockTime

2 answers

✓ Accepted answer

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

1 comment

0

mmmmm. Isn't working

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

2 comments

0

Don't give him the code, explain what you're doing

0

aww man -3

This discussion is preserved as it was. New answers, comments, and votes are closed.