so first, the NPC will at ServerStorage but if the TimeofDay is 20 the NPC will move to Workspace and spawning
(pls help im beginner at coding)
so first, the NPC will at ServerStorage but if the TimeofDay is 20 the NPC will move to Workspace and spawning
(pls help im beginner at coding)
This is how to run code at the time of day you asked for. If you want it to despawn, feel free to add logic following the same.
local Lighting = game:GetService("Lighting")
Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
local timeOfDay = Lighting.ClockTime
if timeOfDay == 20 then
-- spawn
end
end)
Note that the above is untested but it should theoretically work.
thank you i will try to script it
If it ends up working for you just please make sure to mark it as a solution so people don’t end up coming here continuing to try to help!
uhh it doesnt work, does this script work? cuz im new
local Lighting = game:GetService("Lighting")
local ServerStorage = game:GetService("ServerStorage")
local spawnZ = game.Workspace.Spawn1z
Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
local timeOfDay = Lighting.ClockTime
if timeOfDay == 12 then
local Noob = ServerStorage.NPC['NPC Noob']:Clone()
Noob.Parent = game.Workspace.NPC
Noob.HumanoidRootPart.CFrame = CFrame.new(spawnZ.Position + Vector3.new(0,5,0))
end
end)
never mind its work thank you for your script @IllustriousGreed
i just edited some codes then it working
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.