【发布时间】:2018-06-09 12:03:44
【问题描述】:
我正在开发一种自动路灯,它应该会根据时间而改变。这是代码:
--------------------------------------------
-----------Street Light Script!-------------
-----------Made by multiplemark-------------
--------------------------------------------
local ControlledByGameTime = true -- Setting to true makes it so that the lights
activate only during the selected time.
local TurnLightsOnAt = 20 * 60 -- Turns lights on at 8 P.M. by default.
local TurnLightsOffAt = 8 * 60 -- Turns lights off at 8 A.M. by default.
local Lights = script.Parent.PointLight.Enabled
local LightBlock = script.Parent
if ControlledByGameTime == true then
while true do
local CurrentTime = game.Lighting:GetMinutesAfterMidnight()
if CurrentTime >= TurnLightsOffAt then
Lights = false
LightBlock.Material = "SmoothPlastic"
LightBlock.Brick = 163,162,165
end
if CurrentTime >= TurnLightsOnAt then
Lights = true
LightBlock.Material = "Neon"
LightBlock.Brick = 255,255,0
end
end
else
Lights = true
LightBlock.Material = "Neon"
LightBlock.Color = 255,255,0
end
它应该做的是检查时间,如果它符合定义的要求,则更改模型的材质和颜色,并启用/禁用 PointLight。
【问题讨论】:
标签: roblox