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

How may I create an automatic Spotlight/Pointlight?

Asked by 10 years ago

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.

5 answers

Log in to vote
1
Answered by
Maxomega3 106
10 years ago

Enabled property of SpotLights, PointLights, Fire, Smoke, and I believe Sparkles.

Ad
Log in to vote
1
Answered by 10 years ago

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.

Log in to vote
0
Answered by 10 years ago
--May not work I thought of it right at the top of my head
while true do
if game.Lighting.TimeOfDay == 00:00:00 then --Edit this to the time of the light is on
game.Lighting.PointLight:clone().Parent = game.Workspace.Light
if game.Lighting.TimeOfDay == 00:00:00 then --Edit this to the time of the light is off
game.Workspace.Light.PointLight:Remove()
end
end
Log in to vote
0
Answered by 10 years ago

This is kind of a mix of the second and third answers.

while true do
    if game.Lighting.TimeOfDay ==12:00:00 then
        game.Workspace.Brick.PointLight.Enabled = true -- change Brick to the brick, and PointLight to Spotlight if its a Spotlight
    elseif game.Lighting.TimeOfDay == 00:00:00 then  -- change Brick to the brick, and PointLight to Spotlight if its a Spotlight
        game.Workspace.Brick.PointLight.Enabled = false
    end
end

Log in to vote
0
Answered by 10 years ago

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

Answer this question