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: Time of Day Script for pointlights.

Previous Thread :: Next Thread 
robloxian785 is not online. robloxian785
Joined: 30 Oct 2008
Total Posts: 4826
06 Feb 2014 05:59 PM
I'm trying to make a script that updates a value which is read by pointlights in the map so that they're never too bright or dull but I keep returning an error on line five that I'm trying to compare a boolean value with a number value. I understand what the error means but I'm not referencing any boolean values.

Any help is appreciated.

local value = script.Parent.brightness.Value
local minutes = Game.Lighting

while true do
if 0 < (minutes:GetMinutesAfterMidnight()) <= 480 then value = 1 -- 8
elseif 480 < (minutes:GetMinutesAfterMidnight()) <= 540 then value = 0.9 -- 9
elseif 540 < (minutes:GetMinutesAfterMidnight()) <= 600 then value = 0.7 -- 10
elseif 600 < (minutes:GetMinutesAfterMidnight()) <= 660 then value = 0.4 -- 11
elseif 660 < (minutes:GetMinutesAfterMidnight()) <= 720 then value = 0.2 -- 12
elseif 720 < (minutes:GetMinutesAfterMidnight()) <= 780 then value = 0 -- 1
elseif 780 < (minutes:GetMinutesAfterMidnight()) <= 840 then value = 0 -- 2
elseif 840 < (minutes:GetMinutesAfterMidnight()) <= 900 then value = 0.1 -- 3
elseif 900 < (minutes:GetMinutesAfterMidnight()) <= 960 then value = 0.2 -- 4
elseif 960 < (minutes:GetMinutesAfterMidnight()) <= 1020 then value = 0.4 -- 5
elseif 1020 < (minutes:GetMinutesAfterMidnight()) <= 1080 then value = 0.6 -- 6
elseif 1080 < (minutes:GetMinutesAfterMidnight()) <= 1140 then value = 0.7 --7
elseif 1140 < (minutes:GetMinutesAfterMidnight()) <= 1200 then value = 0.8 --8
elseif 1200 < (minutes:GetMinutesAfterMidnight()) <= 1260 then value = 0.9 -- 9
elseif 1260 < (minutes:GetMinutesAfterMidnight()) <= 1440 then value = 1 -- 10 - 12
wait(1)
end
Report Abuse
robloxian785 is not online. robloxian785
Joined: 30 Oct 2008
Total Posts: 4826
06 Feb 2014 05:59 PM
The "local brightness = script.Parent.brightness.Value" is a number value.
Report Abuse
Solsticedev is not online. Solsticedev
Joined: 02 Feb 2014
Total Posts: 343
06 Feb 2014 06:08 PM
local minutes = game:GetService("Lighting").TimeOfDay
Report Abuse
robloxian785 is not online. robloxian785
Joined: 30 Oct 2008
Total Posts: 4826
06 Feb 2014 06:10 PM
Is there any other way? The idea of using the minutes after midnight was so that ir would return a number value rather than the value of the time.
Report Abuse
Solsticedev is not online. Solsticedev
Joined: 02 Feb 2014
Total Posts: 343
06 Feb 2014 06:12 PM
How can you get the value of the tomeofday without actually indexing timeofday...
Report Abuse
robloxian785 is not online. robloxian785
Joined: 30 Oct 2008
Total Posts: 4826
06 Feb 2014 06:14 PM
The time of day changes in a separate script, this is the script responsible for retrieving the minutes after midnight and updating a value called brightness that is read by the pointlights.
Report Abuse
Solsticedev is not online. Solsticedev
Joined: 02 Feb 2014
Total Posts: 343
06 Feb 2014 06:15 PM
Yes, but your original line indexed minutes as lighting, not the time
Report Abuse
robloxian785 is not online. robloxian785
Joined: 30 Oct 2008
Total Posts: 4826
06 Feb 2014 06:17 PM
This script doesn't need to grab time, it needs to grab how far past midnight the game is, unless I'm completely misunderstanding what you're saying.
Report Abuse
Solsticedev is not online. Solsticedev
Joined: 02 Feb 2014
Total Posts: 343
06 Feb 2014 06:19 PM
I apoligize, I misunderstood the way that method worked.
Report Abuse
robloxian785 is not online. robloxian785
Joined: 30 Oct 2008
Total Posts: 4826
06 Feb 2014 06:22 PM
any idea why studio thinks I'm referencing a boolean?
Report Abuse
Solsticedev is not online. Solsticedev
Joined: 02 Feb 2014
Total Posts: 343
06 Feb 2014 06:24 PM
I believe you need ands to check if something is greater than everything else.
Report Abuse
robloxian785 is not online. robloxian785
Joined: 30 Oct 2008
Total Posts: 4826
06 Feb 2014 06:37 PM
still not got a bloody idea on how to do it, if nobody responds in the next fifteen minutes I'll probably just leave it and take a fresh look in the morning.
Report Abuse
Solsticedev is not online. Solsticedev
Joined: 02 Feb 2014
Total Posts: 343
06 Feb 2014 06:39 PM
if minutes:GetMinutesAfterMidnight() > 0 and minutes:GetMinutesAfterMidnight() <= 480 then value = 1

follow this model
Report Abuse
robloxian785 is not online. robloxian785
Joined: 30 Oct 2008
Total Posts: 4826
06 Feb 2014 06:40 PM
you sir, are a star.
Report Abuse
Solsticedev is not online. Solsticedev
Joined: 02 Feb 2014
Total Posts: 343
06 Feb 2014 06:42 PM
Why thank you. If ya want to send me a friend request, send it to my main, domorox17
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