Disappearing Parts/Model at Night and Appearing at Day

I’d like for this to be fixed: the model doesn’t go untransparent at Clocktime 1 and transparent at Clocktime 5, I’ve tried many ways, changing the code around, looking at videos, and I cannot seem to get it to work.

local light = game:GetService("Lighting")
local model = script.Parent
local campsite = model:GetChildren()

while true do
	for i, child in ipairs(campsite) do
		if light.ClockTime <= 1 then
			child.Transparency = 0
		else
			if light.ClockTime <= 5 then
				child.Transparency = 1
			end
		end
	end
end

if light.ClockTime <=5 then
Change it to:
if light.ClockTime >=5 then

1 Like

I want it to appear at 1 and disappear at 5, I don’t think that will help.

Never mind, I misread that. Sorry!

I cannot get it to disappear now.

Did you change both lines to >= ?
The if statement should still be <=1 and the elseif statement should be >=5.

So you want all items in the Model to be visible at 1am and transparent at 5 am?

I can’t remember if you should use light.Clocktime or light.TimeOfDay…

Clocktime would be numerical, TimeOfDay would be traditional: 01:00 but, I think I fixed it now, I really don’t know.

All items in the model to be visible at 1am and anything 5 am or after it is transparent.

Hey there! I’ve gone into a more in-depth tutorial on something similar to this on a different post

1 Like