|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|