How to make an object disappear or anchor when it reaches a certain time

The title basically explains it but how would you make an object disappear or anchor when it reaches 11pm. For example a part would show for 7 hours and then disappear for 7 hours and reappear for a cycle.

If anyone could help it would be very appreciated!

I would suggest using os.time() or os.date() to get the hour, minutes, and seconds of the day that you need, as well as reading up on this problem that someone else had with obtaining the real time of day in real life How to create a clock that says the player's real life time!

From there, you can simply make your object :Destroy() and :Clone() as needed at specific intervals. Hope this helps!

Wouldn’t just setting the canCollide to false and transparency to 1 be easier?

1 Like

That works as well, but for overall cleaning up your game and not having to deal with bugs, I’d just clone whatever object he needs from ServerStorage to the workspace, and destroy it after it’s no longer needed.

Reparenting to nil (as long as you keep a reference) would work just as well, although destroy and clone are fine here since the instance isnt reused frequently

1 Like

I would believe it’d be more annoying having something being deleted then re-cloned (more prone to glitchs), but ig it really depends on what they’re making.

1 Like

I was thinking of this! @Tentorized. Thanks a lot!

1 Like