I know how to use the Spotlight or Pointlight of course. I have a question though of how you would have lights turn off and on without flipping a switch, and it turns on due to the relation of the time. Such as if I was creating a street light for a Town or City game, and it was night they would be on, and if day, off.
Enabled property of SpotLights, PointLights, Fire, Smoke, and I believe Sparkles.
Use the TimeOfDay property in game.Lighting and if the time is more than or less than your desired times, create or destroy the pointlight.
1 | --May not work I thought of it right at the top of my head |
2 | while true do |
3 | if game.Lighting.TimeOfDay = = 00 : 00 : 00 then --Edit this to the time of the light is on |
4 | game.Lighting.PointLight:clone().Parent = game.Workspace.Light |
5 | if game.Lighting.TimeOfDay = = 00 : 00 : 00 then --Edit this to the time of the light is off |
6 | game.Workspace.Light.PointLight:Remove() |
7 | end |
8 | end |
This is kind of a mix of the second and third answers.
1 | while true do |
2 | if game.Lighting.TimeOfDay = = 12 : 00 : 00 then |
3 | game.Workspace.Brick.PointLight.Enabled = true -- change Brick to the brick, and PointLight to Spotlight if its a Spotlight |
4 | elseif game.Lighting.TimeOfDay = = 00 : 00 : 00 then -- change Brick to the brick, and PointLight to Spotlight if its a Spotlight |
5 | game.Workspace.Brick.PointLight.Enabled = false |
6 | end |
7 | end |
Place a block right click on the block you placed point your mouse to insert part click the spotlight and you can use propertys to changer distance and brightness