How can I make this SCRIPT to stop at a certain TIME?

Hello guys, my name is Spideyalvaro999 and I have a serious problem.
I am using a script about cloning and destroying models so that I can create a kind of movement.
There is no problem with this script. The problem is that I’ve been testing for 1 month about how to make this script stop at a certain time(game.Lighting.Clocktime) or (game.Lighting.TimeOfDay), but anything of this worked. Also I’ve been looking in this fantastic forum other Topics but they didn’t solved the problem I had.![2020-06-15|690x387]
Do you know how to make my idea work? Thanks a lot.

1 Like

Something like this would work assuming you had a script to constantly change the clock time so this would actually run.

local lighting = game:GetService("Lighting")
local sequenceActive = false

coroutine.resume(coroutine.create(function()
	while sequenceActive == true do
		wait(1)
		print("Default Roblox Time")
	end
end))

while true do
	wait()
	
	if math.ceil(lighting.ClockTime) ~= 14 then
		sequenceActive = false
	end
end

I use math.ceil because I don’t know if decimals are used in ClockTime at all ??

This reply is what I needed. I do have a script that constanlty change the clock time and about math.ceil, I suppouse that it is valid. I will try this and if it work, I will give you the correct answer. Thank you very much

Yes, ClockTime uses decimals to represent minutes so 0.5 is 30 minutes or 0.5 hours.

1 Like

Just for future reference:

Very useful if you know they exist.

Hi,
If been trying your solution but it didn’t stoped the scrip. Do you know any other solutions?

Can you post the code you used? It may have something to do with that.


Explanation:
The first 4 lines are locals, the rest is a while loop that make 6 diferent models(are at the Server Storage) to clone and destroy. What I need is that script to be stopped at an specific hour and to start working on an other different hour.

This is horribly inefficient. What exactly are you trying to do here?

What Im trying is that 6 different models clone and destroy, so that they aparently seems to be moving, but they are static. Im not an expert in this so I tried my best and created this.

I thought this was a lighting issue

If you does not understand you can see it here
https://www.roblox.com/games/3046785329/1993?refPageId=a382988e-6c0e-4420-a3a0-34c79d5d76ac

Hello guys
After 1 month of work, finally I got the succesfull script that makes the first script stop at a certain time. Explanation:
First I created a script(My chosen hours were 12am and 6am and I named 24h. In this script I clone the first script at the workshop and destroy it from the Server Storage(The script was placed at the Server Storage from the beggining)


After I tried this and worked, I tried to make it in the same script the 6H script, but it failed. So I made another script called 6H. In this script I did the opposite thing that in the 24H. I destroyed the script from the workshop and cloned it at the Server Storage.

Two things you have to know is that the Script at the Server Store doesnt work so I took that in advantage. The Second thing is that I’m not an Script expert so I did what I could
Thanks for reading
SpideyAlvaro999