Hello, I would like to know how to make a gui button appear on the screen every 30 days?
Just use while wait(30) do
and make it visible for a few seconds and then make it disappear again.
1 Like
Use os.time() and datastores. –
2 Likes
And how can I get the date of the last day of the month?
Here is an example
local DataStore = game:GetService("DataStoreService"):GetDataStore("LastLogin") --Get the DataStore.
game.Players.PlayerAdded:Connect(function(Player)
local PlayerGui = Player:WaitForChild("PlayerGui")
local GUI = PlayerGui:WaitForChild("GUI NAME HERE")
wait()
local LastLogin = DataStore:GetAsync(Player.userId)
if LastLogin then
local Seconds = os.time()-LastLogin
local Minutes = Seconds/60
local Hours = Minutes/60
print("It has been: "..Hours.." hours Since your last login") --This just prints how much time has passed since your last login
if Hours >= 720 then -- 30 days
print("You have logged in after 30 days")
-- ENABLE GUI HERE (ex. GUI.TextButton.Visible = true)
DataStore:SetAsync(Player.userId,os.time())
end
else
DataStore:SetAsync(Player.userId,os.time())
end
end)
1 Like
Oh thanks you a lot bro!