What do you mean, I can’t find DefaultLighting anywhere. I have the properties tab own. More specific please?
This might not work, as when I set them TimeOfDay to 8:00:00 it changes to 08:00:00.
You have to select lighting under the explorer.
You’re time of day is set to 07:40:00. Do you change the TimeOfDay anywhere else? The reason for your script not working is because the TimeOfDay isn’t a key of the todn table. (gets no data)
Try changing TimeOfDay to 12:00:00, does that make it work?
I set it to 7:40 to test it. This isn’t the default…
I don’t think you get my point, the reason its not working is because you don’t have anything in the table todn with the key of the 07:40:00 (the time of day)
There is a time changing script. That makes it 8:00:00 at one point… I am saying that when the time goes to 8. Or any other time, it doesn’t change.
I mentioned this before, but the reason this isn’t working is because it’s not formatted correctly.
-- change
['8:00:00'] = w,
-- to
['08:00:00'] = w,
I already changed it. Still nothing.
The actual issue was:
local player = game.Players.LocalPlayer
local r2 = player:WaitForChild("PlayerScripts")
local aslt = r2['[Embedded]7812478612jns'].at_lst12778
local tr = aslt.alst_plrcofigtimeescape3j4
local w = require(tr['8:00A'])
local a = require(tr['7:30P'])
local s = require(tr['12:00A'])
local d = require(tr['3:30P'])
local e = require(tr['12:00P'])
local r = require(tr['6:00A'])
local t = require(tr['9:00P'])
local todn = {
['08:00:00'] = w,
['19:30:00'] = a,
['24:00:00'] = s,
['15:30:00'] = d,
['12:00:00'] = e,
['06:00:00'] = r,
['21:00:00'] = t,
}
wait(.1)
function timeChanged()
if todn[game.Lighting.TimeOfDay] then
print("scrr")
local notifData = todn[game.Lighting.TimeOfDay]
print(notifData.describe)
local notifications = script.at_lst12778.Notifications:Clone()
notifications.notif.descw.Text = notifData.describe
notifications.notif.titlew.Text = notifData.title
wait(1)
s.Parent = player.PlayerGui
end
end
while wait(.2) do
game:GetService("Lighting"):GetPropertyChangedSignal("TimeOfDay"):Connect(timeChanged)
timeChanged()
end
Notice: s.Parent = player.PlayerGui
s isn’t a valid thing. So I had to change s to notifications.
(edit : just found out)
Why are you doing this every .2 seconds? After 1 minute thats already 300 functions connected to whenever TimeOfDay is changed.
Also, it appears you never delete the gui that pops up so over time there will be lots of guis that overlap eachother.
Thanks for the solutions so far, they have been working. Now how do we make this not clone the GUI if the GUI already exists?
local player = game.Players.LocalPlayer
local r2 = player:WaitForChild("PlayerScripts")
local aslt = r2['[Embedded]7812478612jns'].at_lst12778
local tr = aslt.alst_plrcofigtimeescape3j4
local w = require(tr['8:00A'])
local a = require(tr['7:30P'])
local s = require(tr['12:00A'])
local d = require(tr['3:30P'])
local e = require(tr['12:00P'])
local r = require(tr['6:00A'])
local t = require(tr['9:00P'])
local todn = {
['08:00:00'] = w,
['19:30:00'] = a,
['24:00:00'] = s,
['15:30:00'] = d,
['12:00:00'] = e,
['06:00:00'] = r,
['21:00:00'] = t,
}
wait(.1)
function timeChanged()
if todn[game.Lighting.TimeOfDay] then
print("scrr")
local notifData = todn[game.Lighting.TimeOfDay]
print(notifData.describe)
local notifData = todn[game.Lighting.TimeOfDay]
local notifications = script.at_lst12778.Notifications:Clone()
notifications.notif.descw.Text = notifData.describe
notifications.notif.titlew.Text = notifData.title
wait(1)
notifications.Parent = player.PlayerGui
wait(5)
notifications:Destroy()
end
end
while wait(.2) do
game:GetService("Lighting"):GetPropertyChangedSignal("TimeOfDay"):Connect(timeChanged)
timeChanged()
end
You could check with :FindFirstChild().
i.e
local function haschildwithname(instance,name)
return not not instance:FindFirstChild(name)
end
How would this be implemented in the code though?
You could check if there is a child of PlayerGui named “Notifications” and then if there is a child, update the notification gui instead of creating a new one. Just don’t re use the name “Notifications” or there might be some issues.
Would this be a way?
local player = game.Players.LocalPlayer
local r2 = player:WaitForChild("PlayerScripts")
local aslt = r2['[Embedded]7812478612jns'].at_lst12778
local tr = aslt.alst_plrcofigtimeescape3j4
local w = require(tr['8:00A'])
local a = require(tr['7:30P'])
local s = require(tr['12:00A'])
local d = require(tr['3:30P'])
local e = require(tr['12:00P'])
local r = require(tr['6:00A'])
local t = require(tr['9:00P'])
local todn = {
['08:00:00'] = w,
['19:30:00'] = a,
['24:00:00'] = s,
['15:30:00'] = d,
['12:00:00'] = e,
['06:00:00'] = r,
['21:00:00'] = t,
}
wait(.1)
function timeChanged()
if todn[game.Lighting.TimeOfDay] then
print("scrr")
local notifData = todn[game.Lighting.TimeOfDay]
if (not player.PlayerGui:FindFirstChild(player.Name.." 's Notifications")) then --checks
print(notifData.describe)
local notifData = todn[game.Lighting.TimeOfDay]
local notifications = script.at_lst12778.Notifications:Clone()
notifications.notif.descw.Text = notifData.describe
notifications.notif.titlew.Text = notifData.title
wait(1)
notifications.Parent = player.PlayerGui
notifications.Name = player.Name.." 's Notifications"
wait(5)
notifications:Destroy()
end
end
while wait(.2) do
game:GetService("Lighting"):GetPropertyChangedSignal("TimeOfDay"):Connect(timeChanged)
timeChanged()
end
end
It isn’t working, if so.
For some reason, you wrapped this in the function timeChanged. Move this outside the function timechanged. Seriously, remove the while wait(.2) do because connecting a function every .2 seconds and never disconnecting it will lead to a big memory leak extremely quickly.
Instead of yielding and then destroying, use AddItem. The article has some good reasons as to why.
Trying all these recommendations, none are fixing it.
As of now, I am working with my friend to attempt to find solutions. So far, I haven’t found anything to change, here is what the code is;
local player = game.Players.LocalPlayer
local r2 = player:WaitForChild("PlayerScripts")
local aslt = r2['[Embedded]7812478612jns'].at_lst12778
local tr = aslt.alst_plrcofigtimeescape3j4
local w = require(tr['8:00A'])
local a = require(tr['7:30P'])
local s = require(tr['12:00A'])
local d = require(tr['3:30P'])
local e = require(tr['12:00P'])
local r = require(tr['6:00A'])
local t = require(tr['9:00P'])
local todn = {
['08:00:00'] = w,
['19:30:00'] = a,
['24:00:00'] = s,
['15:30:00'] = d,
['12:00:00'] = e,
['06:00:00'] = r,
['21:00:00'] = t,
}
wait(.1)
function timeChanged()
if todn[game.Lighting.TimeOfDay] then
print("scrr")
local notifData = todn[game.Lighting.TimeOfDay]
if (not player.PlayerGui:FindFirstChild(player.Name.." 's Notifications")) then --checks
print(notifData.describe)
local notifData = todn[game.Lighting.TimeOfDay]
local notifications = script.at_lst12778.Notifications:Clone()
notifications.notif.descw.Text = notifData.describe
notifications.notif.titlew.Text = notifData.title
wait(1)
notifications.Parent = player.PlayerGui
notifications.Name = player.Name.." 's Notifications"
wait(5)
notifications:Destroy()
end
end
while wait(.2) do
game:GetService("Lighting"):GetPropertyChangedSignal("TimeOfDay"):Connect(timeChanged)
timeChanged()
end
end
Your issue is the that the timeChanged() function never gets called. You should move where it calls timeChanged() outside the function so it works correctly.