Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

0
also I want it to close lol and I want it to loop TEETHOF09 0 — 4y
0
You can specify how long it takes by setting a delay in the tween info SteamG00B 1633 — 4y
0
thanks TEETHOF09 0 — 4y

1 answer

Log in to vote
0
Answered by
iivSnooxy 248 Moderation Voter
4 years ago

You can specify how long it takes by setting a delay in the tween info https://developer.roblox.com/en-us/api-reference/class/TweenService

Ad

Answer this question