generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Probably screwed up. A bit.

Previous Thread :: Next Thread 
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
28 Aug 2013 07:16 PM
currenttime >= "18:00:00"
A string can't be compared in value with something else.
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
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
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
28 Aug 2013 07:25 PM
Anyone? :/
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
28 Aug 2013 07:31 PM
Nice. No one can help. :L
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
28 Aug 2013 07:35 PM
You're not giving us output. You're just asking us what's wrong.
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
28 Aug 2013 07:41 PM
Ok maybe give us the revised version.
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
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 is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
28 Aug 2013 07:48 PM
if currenttime >= "18:00:00" then

What I tell you b4.
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
28 Aug 2013 08:03 PM
So how do I tell if it's 18:00?
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
28 Aug 2013 08:12 PM
You tell if it's after 18:00 by using the GetMinutes thing duh.
Report Abuse
blocco is not online. 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 is not online. 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
bigdaddy92 is not online. bigdaddy92
Joined: 17 Jan 2010
Total Posts: 1684
28 Aug 2013 08:22 PM
hi
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
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 is not online. blocco
Joined: 14 Aug 2008
Total Posts: 29474
28 Aug 2013 08:26 PM
Lua doesn't distribute function calls
Report Abuse
GreenDay987 is not online. GreenDay987
Joined: 21 May 2011
Total Posts: 7027
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image