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 » Scripters
Home Search
 

Manipulating the Lighting...

Previous Thread :: Next Thread 
DesignerDavid is online. DesignerDavid
Joined: 18 Feb 2014
Total Posts: 8422
28 Jul 2015 05:53 PM
So what I'm trying to do is I'm trying to manipulate the TimeOfDay in the Lighting's Property to increase when a Part is touched. The TimeOfDay is currently at 16:00:00. I want to travel from 16:00:00 to 17:00:00 slowly, not fast.

Here's the script:

local debounce = true
local lighting = game:GetService("Lighting")
local duration = 0.1

script.Parent.Touched:connect(function()
if debounce == true then
debounce = false

for i = 1, 1000 do
wait(0.05)
lighting.TimeOfDay = lighting.TimeOfDay + 1
end

end
end)


And if you're happening to know what the Output says, here it is:

15:47:07.062 - Workspace.Part.Script:11: attempt to perform arithmetic on field 'TimeOfDay' (a string value)

What does that mean?
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 Jul 2015 05:54 PM
You're trying to perform arithmetic on a string?

I thought that was pretty self-explanatory.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 Jul 2015 05:55 PM
Also use this:

http://wiki.roblox.com/index.php?title=API:Class/Lighting/GetMinutesAfterMidnight
http://wiki.roblox.com/index.php?title=API:Class/Lighting/SetMinutesAfterMidnight
Report Abuse
DesignerDavid is online. DesignerDavid
Joined: 18 Feb 2014
Total Posts: 8422
28 Jul 2015 06:06 PM
I did something different. It...sorta works. It just wont do as I type, it'll just change the TimeOfDay to "00:01:00"

local debounce = true
local lighting = game:GetService("Lighting")
local duration = 0.1

script.Parent.Touched:connect(function()
if debounce == true then
debounce = false

for i = 1, 1000, 1 do
wait(0.1)
lighting = lighting + lighting:SetMinutesAfterMidnight(tostring(i))
end

end
end)

And now the Output says:

16:04:31.280 - Workspace.Part.Script:11: attempt to perform arithmetic on upvalue 'lighting' (a userdata value)

Help?
Report Abuse
DesignerDavid is online. DesignerDavid
Joined: 18 Feb 2014
Total Posts: 8422
28 Jul 2015 06:10 PM
Bump.

Growing old is mandatory - growing up is optional.
Report Abuse
DesignerDavid is online. DesignerDavid
Joined: 18 Feb 2014
Total Posts: 8422
28 Jul 2015 06:14 PM
Double Bump.

Growing old is mandatory - growing up is optional.
Report Abuse
DesignerDavid is online. DesignerDavid
Joined: 18 Feb 2014
Total Posts: 8422
28 Jul 2015 06:18 PM
Triple Bump.

Growing old is mandatory - growing up is optional.
Report Abuse
DesignerDavid is online. DesignerDavid
Joined: 18 Feb 2014
Total Posts: 8422
28 Jul 2015 06:25 PM
Never mind, I've figured it out.

Growing old is mandatory - growing up is optional.
Report Abuse
thedestroyer115 is not online. thedestroyer115
Joined: 19 Dec 2010
Total Posts: 11546
28 Jul 2015 06:33 PM
lighting:SetMinutesAfterMidnight(lighting:GetMinutesAfterMidnight() + 1)

???
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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