Hey! I am attempting to make a timeofday alert, and it wont work.
The script doesn’t have any errors.
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 = {
['8: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)
if todn[game.Lighting.TimeOfDay] then
print(todn[game.Lighting.TimeOfDay])
local s = aslt.Notifications:Clone()
s.notif.descw.Text = todn.describe
s.notif.titlew.Text = todn.title
wait(1)
s.Parent = player.PlayerGui
end
game.Lighting.Changed:Connect(function()
if todn[game.Lighting.TimeOfDay] then
print(todn[game.Lighting.TimeOfDay])
local s = aslt.Notifications:Clone()
s.notif.descw.Text = todn.describe
s.notif.titlew.Text = todn.title
wait(1)
s.Parent = player.PlayerGui
end
end)
The code in the modules:
--example
local desc = {
['title'] = 'Midnight!',
['describe'] = 'Get to bed!',
}
return desc
This system is like Jailbreaks alerts, I am just trying to get it to work. If anyone could help would be appreciated!
First of all, I advise you to make your instance/variable names clear and understandable.
Names like aslt, r2 are way too shortened to a point where it cannot be distinguished, and can be a roadblock for your future development.
Secondly, be more specific about what’s not working; We just cannot know by confidence at which part of your code doesn’t work if you don’t provide enough details.
This is not a solution; However I will try to fix unnecessary parts as much as possible.
At the line 3~4, please make names understandable. At the line 5~11, you don’t need to create multiple modules for those, as you seems to use them for only returning tables. So you can reconstruct your dictionary (table) similar to:
If you’re aiming for dynamic stuffs, then proceed with using modules. But I encourage to not to, for now.
At the line 21 wait(.1) seems unnecessary.
At the line 23~ (if statement) and line 31~ (even connection), you can make it to a single function then connect it:
function timeChanged()
if todn[game.Lighting.TimeOfDay] then
local notifData = todn[game.Lighting.TimeOfDay]
print(notifData)
local notifications = aslt.Notifications:Clone()
notifications.notif.descw.Text = notifData.describe
notifications.notif.titlew.Text = notifData.title
wait(1)
s.Parent = player.PlayerGui
end
end
game:GetService("Lighting").Changed:Connect(timeChanged)
timeChanged()
There is no error, when the time changes to one of the times listed it doesn’t work. What I am trying to explain is each time; example 8:00:00 has a module for itself, as seen why it says [‘19:30:00’] = a,
ect. Because on the top it says local a = require(tr[‘7:30P’]) , it is requiring a module with certain settings, I provided an example of what one of the modules would look like. The reason why it is so shortened is because this is the type some code, and random numbers make it harder to understand for some exploiters , the script still functions the same. As seen this is what a module would look like;
--example
local desc = {
['title'] = 'Midnight!',
['describe'] = 'Get to bed!',
}
return desc
Don’t try to self-encrypt names, exploiters can always find out what it is.
There is way too much disadvantages compared to advantages you get from it.
Your script checks once, and then every time the Lighting changes
Light.Changed will fire for any update to the properties, so I would suggest you use GetPropertyChangedSignal instead. Changing time of day also appear to change ClockTime so it will fire twice.
Your script probably isn’t working because you never update the time of day and the default time (14:00:00) isn’t in the table todn.
This appears to have few issues,
Text is being set to nil value (describe or title aren’t in the todn table)
The gui is never destroyed, which means guis will build up over time.
Yeah, that’s why. It is actually to make exploiters annoyed and not to understand. This topic still doesn’t have a solution, and I am confused. As we speak, I am trying to fix this!
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 = {
['8: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:GetMinutesAfterMidnight()] then --changed to that
local notifData = todn[game.Lighting.TimeOfDay]
print(notifData)
local notifications = aslt.Notifications:Clone()
notifications.notif.descw.Text = notifData.describe
notifications.notif.titlew.Text = notifData.title
wait(1)
s.Parent = player.PlayerGui
end
end
game:GetService("Lighting").Changed:Connect(timeChanged)
timeChanged()
This is probably your issue, as the todn table has strings formatted like TimeOfDay but you’re checking if the minutes after midnight (a number) is in the table, which it isn’t.
You should change it back to
if todn[game.Lighting.TimeOfDay] then
I would still recommend GetPropertyChangedSignal because .Changed will fire whenever any property is changed.
I’m guessing that the time isn’t changing perfectly onto the times in “todn” and therefore this line:
if todn[game.Lighting.TimeOfDay] then
Isn’t becoming true, as the TimeOfDay isn’t exactly 8:00:00, for example.
To solve this, you could check if the current time is between a certain range, or is larger than a time value and then ignore this time in the next checks.
But, have no idea if this is the problem, just a guess