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

Time script is working but server storage thing is not?

Asked by
Troevan -8
5 years ago

Here is my code

-- day length is minutes
local dayLength = 5

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

while true do
    wait(197)
        game.ServerStorage.Night.Parent = workspace
        wait(1)
        game.ServerStorage.Gun.Parent = game.StarterPack
        wait(1)
        game.ServerStorage.NightSky.Parent = game.Lighting
        wait()
        game.Lighting.DaySky.parent = Game.ServerStorage
        wait()
        game.Workspace.Day.Parent = Game.ServerStorage
    end
while true do
    wait(236)
        game.ServerStorage.Day.Parent = workspace
        wait(1)
        game.ServerStorage.DaySky.Parent = game.Lighting
        game.ServerStorage.Night.Parent = workspace
        wait(1)
        game.ServerStorage.Gun.Parent = game.StarterPack
        wait(1)
        game.ServerStorage.NightSky.Parent = game.Lighting
        game.Workspace.Night.Parent = Game.ServerStorage.Night
        wait()
        game.Lighting.NightSky.Parent = Game.ServerStorage
        game.StarterPack.Gun.Parent = Game.ServerStorage
end

Im trying to make a game where at these points you have to fight monsters and at day not. erm script. Can you help me please?

0
please help me i need is big help Troevan -8 — 5y

Answer this question