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

What is wrong with this simple script?

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?

2 comments

0

is it in a localscript? if it is then localscripts cant acces serverstorage on online mode

0

nope, its in an ordinary script

2 answers

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

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)

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