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
 

Script that only works after a certain time?

Previous Thread :: Next Thread 
CeruleanTides is not online. CeruleanTides
Joined: 20 Oct 2010
Total Posts: 736
15 Nov 2014 10:19 AM
Hey, I've been working on a script for a few weeks and it's getting complicated. I'm a beginner scripter and I'm wondering how to make the script below only run when the time hits 0:00:00. I'm pretty sure it isn't too hard to do this.
This is the script. Don't take any notice into what it does as all I'm asking for is to make this only work when the time hits 0:00:00.

I've tried creating a script that enables the script at a chosen time, but that doesn't work for some reason. Thank you for your help :)


script.Parent.Changed:connect(function()
if script.Parent.Value == 1 then ---- Sunny
game.Workspace.Rain:Stop()
game.Lighting.FogEnd = 10000
game.Lighting.Brightness = 1
game.Workspace.RainValue.Value = 0
end
end)

script.Parent.Changed:connect(function()
if script.Parent.Value == 2 then ---- Light Rain
game.Workspace.Rain:Stop()
game.Workspace.Rain.Volume = 0.25
game.Lighting.FogEnd = 1000
game.Lighting.Brightness = 0.75
game.Workspace.RainValue.Value = 1
wait(1)
game.Workspace.Rain:Play()
end
end)

script.Parent.Changed:connect(function()
if script.Parent.Value == 3 then ---- Heavy Rain
game.Workspace.Rain:Stop()
game.Workspace.Rain.Volume = 0.25
game.Lighting.FogEnd = 1000
game.Lighting.Brightness = 0.75
game.Workspace.RainValue.Value = 1
wait(1)
game.Workspace.Rain:Play()
wait(5)
game.Workspace.Rain.Volume = 0.5
game.Lighting.FogEnd = 800
game.Lighting.Brightness = 0.5
game.Workspace.RainValue.Value = 2
end
end)

script.Parent.Changed:connect(function()
if script.Parent.Value == 4 then ---- Thunderstorm
game.Workspace.Rain:Stop()
game.Workspace.Rain.Volume = 0.25
game.Lighting.FogEnd = 1000
game.Lighting.Brightness = 0.75
game.Workspace.RainValue.Value = 1
wait(1)
game.Workspace.Rain:Play()
wait(5)
game.Workspace.Rain.Volume = 0.5
game.Lighting.FogEnd = 800
game.Lighting.Brightness = 0.5
game.Workspace.RainValue.Value = 2
wait(5)
game.Workspace.Rain.Volume = 1
game.Lighting.FogEnd = 500
game.Lighting.Brightness = 0
game.Workspace.RainValue.Value = 3
end
end)
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
15 Nov 2014 10:25 AM
The best way to do it is to add an event handler into whatever is doing your day/night

if game.Lighting:GetMinutesAfterMidnight()%60*24==0 then
Report Abuse
CeruleanTides is not online. CeruleanTides
Joined: 20 Oct 2010
Total Posts: 736
15 Nov 2014 10:29 AM
Thank you. I can try this however I have not included a lot of what I'm working on, so I might have to spend a lot of time changing things if I wanted to use that way. If there is any way I could do this in the script ( If you know what I mean, hard to explain ) then that would be a lot more beneficial even if it's not the best way.
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
15 Nov 2014 10:31 AM
First, stop connecting to the same event so many times in the same script
Second, use the condition I just showed.
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