local CurrentDate=os.date("!*t", os.time())
if CurrentDate.month==12 then -- Only Run code when month is december
if CurrentDate.day==1 then -- Add Code For Day1 GiveAway
elseif CurrentDate.day==2 then -- Add Code For Day2 GiveAway
-- and so on.
end
end
local CurrentDate=os.date("!*t", os.time()) -- returns UTC time, lua table
local CurrentDate=os.date("*t", os.time()) -- returns player time, lua table
local dateofplayer = os.date("*t") -- a lua table
local day = dateofplayer["day"]
local month = dateofplayer["month"]
local year = dateofplayer["year"]
Now using these variables make your door using if and elseif statements
You could just reset all the doors to unavailable at the beginning and then set the current days door to claim:
local Calendar = script.Parent
local Frame = Calendar.Parent
local CurrentDate=os.date("*t", os.time())
if CurrentDate.month == 12 then
-- First Reset all doors to unavailable
for _,day in ipairs(Calendar:GetChildren()) do
day.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
day.Button.Text = "UNAVAILABLE"
end
-- Set todays calander to claim
local TodaysDoor=Calendar[tostring(CurrentDate.day)]
TodaysDoor.BackgroundColor3 = Color3.fromRGB(115,255,115)
TodaysDoor.Button.Text = "CLAIM"
end
local Calendar = script.Parent
local Frame = Calendar.Parent
local CurrentDate=os.date("*t", os.time())
if CurrentDate.month == 12 then
for _,day in ipairs(Calendar:GetChildren()) do
local dayNo=tonumber(day.Name)
if dayNo<CurrentDate.day then -- dayNo is less than today so mark as unavailable
day.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
day.Button.Text = "UNAVAILABLE"
elseif dayNo==CurrentDate.day then -- dayNo is today
day.BackgroundColor3 = Color3.fromRGB(115,255,115)
day.Button.Text = "CLAIM"
elseif dayNo>CurrentDate.day then -- dayNo is greater than today so set to coming soon
day.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
day.Button.Text = "COMING SOON"
end
end
end
Thanks for replying, I imported it into my game but it doesn’t seem to work… To test it I set it to CurrentDate.month == 11 for November but all it does is making 18 unavailable.
I also need a way for the script not to pick up on Script and the UIGridLayout. I know this can be used by using Instance:IsA() but again, I’m too stupid to figure out how to do it.
local Calendar = script.Parent
local Frame = Calendar.Parent
local CurrentDate=os.date("*t", os.time())
if CurrentDate.month == 12 then
for _,day in ipairs(Calendar:GetChildren()) do
if day:IsA("Frame") then
local dayNo=tonumber(day.Name)
if dayNo<CurrentDate.day then -- dayNo is less than today so mark as unavailable
day.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
day.Button.Text = "UNAVAILABLE"
elseif dayNo==CurrentDate.day then -- dayNo is today
day.BackgroundColor3 = Color3.fromRGB(115,255,115)
day.Button.Text = "CLAIM"
elseif dayNo>CurrentDate.day then -- dayNo is greater than today so set to coming soon
day.BackgroundColor3 = Color3.fromRGB(150, 150, 150)
day.Button.Text = "COMING SOON"
end
end
end
end
Is there datastores that once you’ve claimed your daily door, you can’t rejoin an claim it again?
Also, how to I make a counter that says how many ‘Christmas points’ you have, then when you reach 10 it gives you a badge. You earn 1 Christmas point for opening 1 door.
Yes, you will need to set up a datastore to keep track of players who have already claimed for that day, the datastore could also keep a record of how many ‘Christmas points’ the player has - but since this is now a question about DataStores/Badges you should really create a new post asking for help on these subjects and mark this post as Solved. It helps other users who are looking for answers to similar questions find the solutions they need too.