I’m quite new to scripting, so my script might be messy, but basically, the way the gui works, is you can type in “Night”, you press confirm and the game time changes.
Do you have an other scripts that change the time of day manually. Like any loops that increase the time every second? If you had a loop that changed the time on the server then it would cause this issue.
Please format your code better so it is easier to read. You do not need to use the ```lua specifier like on Discord, as on the DevForum, three ` keys by themselves do the job just fine, like in this example:
I think most would agree that typing in a word for the time of day seems like a strange way of changing the in-game time. Some immediate problems you face are:
People will misspell words, enter an unspecified word, or enter words in the wrong case.
day noon Evning Nihgt MOrning
Many players do not know English.
A better idea is to simply use a slider for this purpose. I created a standalone day/night slider for some of my games, including Doomspire Brickbattle. Because I made it strictly for myself, implementing it isn’t exactly optimal for other developers at the moment, but I will show how to use it here.
Insert this model to have the system in your game.
Put this LocalScript into game.StarterPlayer.StarterPlayerScripts to make it so typing /time in the chat will open the menu.
Opening the menu with a chat command is the only pre-set method I created for others to use, but I imagine you won’t want to use this method. Hence why I separated the system script from the opener script—you can create your own opening method with this, too.
Take the _G function from inside the chat opener LocalScript and implement it into a GUI, perhaps being displayed when you click a button. The only issue here is that the slider GUI itself was made by me and probably does not fit the same aesthetic style you have in your game. Changing this would require forking the module, which can be retrieved from within the script in the first link above.