|
| 28 Aug 2013 07:13 PM |
I'm trying to make this so that after a certain time all the lights in the place turn on. Super freakin' rusty (I'm more of a GUI person) so I think I screwed up a bit.
(This is in workspace, normal script.)
local speed = 30
time = game:service("Lighting"):GetMinutesAfterMidnight()
local full = 60 * 60 * 12
while true do time = (time + wait()/60*speed) game:service("Lighting"):SetMinutesAfterMidnight(time) if time >= full then time = time - full end end
w = game.Workspace
local currenttime = game.Lighting.TimeOfDay
if currenttime >= "18:00:00" then function turnOn() for _, v in pairs(w:GetChildren()) do if v:IsA("Part") then x = v:GetChildren() if x:IsA("SpotLight") or ("PointLight") then x.Enabled = true end end end end end
if currenttime >= "18:00:00" then turnOn() end |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 07:16 PM |
currenttime >= "18:00:00" A string can't be compared in value with something else. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 07:17 PM |
*facepalm*
Dang it. Realizing my stupidity. Is that the only thing that's wrong, or anything else? |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 28 Aug 2013 07:35 PM |
| You're not giving us output. You're just asking us what's wrong. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 07:40 PM |
| It's not GIVING an output. I'm not completely stupid, if it gave an output I'd be able to fix it on my own. T_T |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 07:41 PM |
| Ok maybe give us the revised version. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 07:42 PM |
All I did was fix the >=.
local speed = 30
time = game:service("Lighting"):GetMinutesAfterMidnight()
local full = 60 * 60 * 12
while true do time = (time + wait()/60*speed) game:service("Lighting"):SetMinutesAfterMidnight(time) if time >= full then time = time - full end end
w = game.Workspace
local currenttime = game.Lighting.TimeOfDay
if currenttime == "18:00:00" then function turnOn() for _, v in pairs(w:GetChildren()) do if v:IsA("Part") then x = v:GetChildren() if x:IsA("SpotLight") or ("PointLight") then x.Enabled = true end end end end end
if currenttime >= "18:00:00" then turnOn() end |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 28 Aug 2013 07:46 PM |
| you still can't perform math on a string |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 07:48 PM |
if currenttime >= "18:00:00" then
What I tell you b4. |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 08:03 PM |
| So how do I tell if it's 18:00? |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 08:12 PM |
| You tell if it's after 18:00 by using the GetMinutes thing duh. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 28 Aug 2013 08:14 PM |
> if x:IsA("SpotLight") or ("PointLight") then
How's Lua going to know what that means? |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 28 Aug 2013 08:21 PM |
| Yeah he's going to end up setting everything that has "enabled" in it to true |
|
|
| Report Abuse |
|
|
| |
|
|
| 28 Aug 2013 08:26 PM |
...
I'm not asking for you guys to be a bunch of smartarses, I want to know how to fix this thing. So I'd appreciate if you'd just give me a straight up answer. T_T
And hi big. |
|
|
| Report Abuse |
|
|
blocco
|
  |
| Joined: 14 Aug 2008 |
| Total Posts: 29474 |
|
|
| 28 Aug 2013 08:26 PM |
| Lua doesn't distribute function calls |
|
|
| Report Abuse |
|
|
|
| 28 Aug 2013 08:29 PM |
| Alright, so what am I supposed to do to get it to work? A friend really needs this for his build he's making tomorrow. |
|
|
| Report Abuse |
|
|
janthran
|
  |
| Joined: 15 May 2009 |
| Total Posts: 17429 |
|
|
| 28 Aug 2013 08:45 PM |
if x:IsA("SpotLight") or x:IsA ("PointLight") then Is the proper way to do that line. |
|
|
| Report Abuse |
|
|