I was just wondering, if it is possible to create a script (and how would I create a script) that only allows players into a server at certain times of the day, for example if the player doesn’t join between 19:00 to 21:00 and they try to join out of them opening times it will kick them from the server.
I can’t seem to find any forum topics on it so I thought I would ask.
Make the game private and only enable it when you want players to join
Put the following code into a server script in serverscriptservice:
game.Players.PlayerAdded:Connect(function()
if not (os.date("*t",now)["hour"] > 19 and os.date("*t",now)["hour"] < 21) then
player:Kick("You cannot join now.")
end
end)
game.Players.PlayerAdded:Connect(function(player) -- I completly forgot the player argument omg
if not (os.date("*t",os.time())["hour"] > 19 and os.date("*t",os.time())["hour"] < 21) then
player:Kick("You cannot join now.")
end
end)
I forgot the player argument in the function. Whoops