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

Why is the neon not turning into Concrete, then at night turning back to Neon?

Asked by 8 years ago

I have Crazyman32's Day/Night script and so I made this script, when it's night these bricks will turn neon and during day to concrete, but it isn't working. Help!

local brickred1 = game.Workspace.("RED")
local brickred2 = game.Workspace.("RED2")
local brickwhite1 = game.Workspace.("WHITE")
local brickwhite2 = game.Workspace.("WHIT2")


 while wait() do  
  local lighting = game:GetService("Lighting")
   if lighting.TimeOfDay >= "18:00:00" then
    --This is where the bricks will start to change in material
   brickred1.Material = "Neon"
   brickred2.Material = "Neon"
   brickwhite1.Material = "Neon"
   brickwhite2.Material = "Neon"

    else
     if lighting.TimeOfDay <= "05:00:00" then
      --This is where the bricks will go back to concrete because it's daytime
      brickred1.Material = "Concrete"
      brickred2.Material = "Concrete"
      brickwhite1.Material = "Concrete"
      brickwhite2.Material = "Concrete"

      --Right here is the code that checks if anything is not working
      --To check if it broke or not, just press F9 and go through each of the tabs
    if lighting.TimeOfDay <= "05:00:00" and brickred1.Material == "Concrete" then
      local val = Instance.new("NumberValue",script.Parent)
     val.Value = val.Value + 1
       if val.Value + 1 then
        print("looping + 1")
     if not val.Value + 1 then
       print("looping - 1 and it broke.")

end
 end
   end
 end

1 answer

Log in to vote
1
Answered by
Acheo 230 Moderation Voter
8 years ago
brickRedA = game.Workspace:WaitForChild("RED")
brickRedB = game.Workspace:WaitForChild("RED2")
brickWhiteA = game.Workspace:WaitForChild("WHITE")
brickWhiteB = game.Workspace:WaitForChild("WHITE2")

game.Lighting.Changed:connect(function()
if game.Lighting.TimeOfDay >= "18:00:00" then
brickRedA.Material = "Neon"
brickRedB.Material = "Neon"
brickWhiteA.Material = "Neon"
brickWhiteB.Material = "Neon"

elseif game.Lighting.TimeOfDay <= "05:00:00" then
brickRedA.Material = "Concrete"
brickRedB.Material = "Concrete"
brickWhiteA.Material = "Concrete"
brickWhiteB.Material = "Concrete"
end
end)

You did spell white incorrectly, so that may be the issue. Also, I wasn't sure if you wanted neon at night so right now it's set to neon in the day time I believe. If it's not working then just reply and I'll see. I'm currently in school and have no access to ROBLOX so I cannot test things.

0
You can't check if a string is lower than or greater than (or equal to) another string as you're doing in lines 7 and 13. You have to use the GetMinutesFromMidnight method of Lighting and then convert hours to minutes (hour * 60). You can then compare the minutes after midnight to the hour (converted to minutes). Spongocardo 1991 — 8y
0
I thought so, I was in school at the time. Acheo 230 — 8y
0
So does this mean the script won't work? VirtualFlying 55 — 8y
0
Pretty much, I can make one now if you'd like. Acheo 230 — 8y
Ad

Answer this question