So basically, when it’s 18:00 I want it to do a function, pretty simple, no errors but doesn’t work.
game.Players.PlayerAdded:Connect(function(player)
function paycheck()
print("PAYCHECK APE")
--rest of my code
--rest of my code
end
end)
if game.Lighting.ClockTime == 18 then
paycheck()
end
at the part “–rest of my code” is just copying gui and placing in playergui,
This is more of a backup, but could the GUI be handled client sided and triggered via a remote event?
That way you could run something like
local Lighting = game:GetService("Lighting")
Lighting:GetPropertyChangedSignal("ClockTime"):Connect(function()
if Lighting.ClockTime == 18 then
-- fire a remote event with the correct arguments
end
end)
This is from the hub:
“Note, this property does not correspond with the actual time of day and will not change during the game unless it has been changed by a script.”
That makes way more sense,
do what @nuttela_for1me suggested and use ‘TimeOfDay’
Use string.sub() or something to get the hour, then index that with ‘18’.
local Lighting = game:GetService("Lighting")
Lighting:GetPropertyChangedSignal("TimeOfDay"):Connect(function(player)
if Lighting.TimeOfDay == "18:00:00" then
print("|| PlayerUI || Code ran without error ||")
end
end)
I’m not sure what TimeOfDay uses, I don’t know if it’s a string or not.
Try using print(string.sub(Lighting.TimeOfDay, 1, 2)) and see if it returns the first two numbers.