ClockTime if statement issue

mark it as a solution if it works and also I realized you need to set a variable for lighting or just do local lighting = game:GetService("Lighting") local Clocktime = lighting.ClockTime

Oh, okay! Yeah, in the message I was asking if you guys had any ideas on making it so that the coffee is only removed one time at 4-5 AM. I was thinking of doing something like this in the elseif?

elseif clockTime <= 4 or clockTime >= 5 then
				local coffee = player.Backpack:WaitForChild("Coffee") or player.Character:WaitForChild("Coffee")
				coffee:Destroy()
				removeKnives()
		end 

But when I tried that, the same problem occurs: i cannot click on the coffee during daytime. I tried the scripts from the other people but they did not work as well so I was wondering!

Your destroying the coffee, but how does it come back?

I have a clickdetector in another script! So whenever you click on it, it can appear in your inventory.

function coffee(player)
	local lighting = game:GetService("Lighting")
	local clockTime = lighting.ClockTime
	local checkCoffee = player.Backpack:FindFirstChild("Coffee") or player.Character:FindFirstChild("Coffee")
	
	if clockTime >= 5 or clockTime <= 20 then
		local coffee = game.Lighting.Coffee:Clone()
		coffee.Parent = player.Backpack
end

end

script.Parent.ClickDetector.MouseClick:Connect(coffee)

Do something like

If clocktime >= 4 and clocktime <=5 then
Coffee:Destroy()