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

What is wrong with this simple script?

Asked by 10 years ago
zombies = game.ServerStorage.zombs:Clone()


if game.Lighting.TimeOfDay == "19:00:00" then
    zombies.Parent = game.Workspace

end

where zombs is a model full of zombies?

0
is it in a localscript? if it is then localscripts cant acces serverstorage on online mode TochiWasHere 10 — 10y
0
nope, its in an ordinary script Shaydesilva 85 — 10y

2 answers

Log in to vote
0
Answered by
HexC3D 830 Moderation Voter
10 years ago

This should be working, maybe the map is teleporting into workspace but you can't see it, in that case use theMoveTo() Method to move to your liking, Also you can put your map in lighting, it might help, but this script should work.

Ad
Log in to vote
0
Answered by
Ekkoh 635 Moderation Voter
10 years ago

It probably is working, it's just not doing what you expect it to do. This script will only check the TimeOfDay once, and that's when the script first runs. So if it's not 19:00:00 when the script runs, it doesn't put the zombies in Workspace. I'd do something like this-

local Lighting = Game:GetService("Lighting")
local Storage = Game:GetService("ServerStorage")

Lighting.LightingChanged:connect(function()
    -- midnight = 00:00:00
    -- 19:00:00 is 1140 minutes after midnight
    if Lighting:GetMinutesAfterMidnight() == 1140 then
        -- Spawn zoms model
        local zoms = Storage:FindFirstChild("zoms"):Clone()
        zoms.Parent = Workspace
    end
end)

Answer this question