Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a timed door that slides open and closed?

I have tried many timed doors and none of them work I don't have a script for timed doors but I do have a script for day / night cycle I want the door to slide open for 5 minutes after a minute into the day Script for day / night cycle

local dayLength = 20

local cycleTime = dayLength*60
local minutesInADay = 24*60

local lighting = game:GetService("Lighting")

local startTime = tick() - (lighting:getMinutesAfterMidnight() / minutesInADay)*cycleTime
local endTime = startTime + cycleTime

local timeRatio = minutesInADay / cycleTime

if dayLength == 0 then
	dayLength = 1
end

repeat
	local currentTime = tick()
	
	if currentTime > endTime then
		startTime = endTime
		endTime = startTime + cycleTime
	end
	
	lighting:setMinutesAfterMidnight((currentTime - startTime)*timeRatio)
	wait(1/15)
until false

the 20 is how many minutes the day / night is

4 comments

0

also I want it to close lol and I want it to loop

0

You can specify how long it takes by setting a delay in the tween info

0

thanks

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.