I've created a script that will auto update the labels of a GUI. I've tried both Script and LocalScript, yet nothing is working for me. There are no errors whatsoever, which makes me think that the script isn't even running at all.
Here is my code if you need it:
--[[
-- INFO --
Weather
0 = Normal
1 = Rain
2 = Thunderstorm
]]
-- Settings --
local songs = { -- All songs must be 60 seconds or longer (even 59.9999 is not recommended)
-- Normal
{Song = script.Day, Weather = 0, TimeOfDay = {"Dawn","Noon"}},
{Song = script.Sunset, Weather = 0, TimeOfDay = {"Dusk"}},
{Song = script.Night, Weather = 0, TimeOfDay = {"Night"}},
-- Rain
{Song = script.MorningRain, Weather = 1, TimeOfDay = {"Dawn"}},
{Song = script.Rain, Weather = 1, TimeOfDay = {"Noon","Evening"}},
{Song = script.NightRain, Weather = 1, TimeOfDay = {"Night"}},
-- Thunder
{Song = script.Thunderstorm, Weather = 2, TimeOfDay = {"Dawn","Noon","Dusk","Night"}}
}
-- Script --
game:GetService("RunService").Heartbeat:Wait()
local RS = game:GetService("RunService")
local dayLabel = script.Parent.Day
local timeOfDayLabel = script.Parent.TimeOfDay
local music = script.Parent.Music
RS.Stepped:connect(function()
local timeOfDay = "Night"
local weatherString = ""
if (game.Lighting.ClockTime > -1) and (game.Lighting.ClockTime < 6) then
timeOfDay = "Night"
elseif (game.Lighting.ClockTime < 12) then
timeOfDay = "Dawn"
elseif (game.Lighting.ClockTime < 18) then
timeOfDay = "Noon"
elseif (game.Lighting.ClockTime < 24) then
timeOfDay = "Dusk"
end
if game.Lighting.Weather.Value == 1 then
weatherString = " (Rain)"
elseif game.Lighting.Weather.Value == 2 then
weatherString = " (Thunder)"
end
dayLabel = "Day "..game.Lighting.Day.Value
timeOfDayLabel = timeOfDay..weatherString
for _,i in pairs(songs)do
if (i.Weather == game.Lighting.Weather.Value) then
local found = false
for _,v in pairs(i.TimeOfDay)do
if v == game.Lighting.TimeOfDay.Value then
found = true
music.SoundId = i.Song.SoundId
end
end
if found == true then break end
end
end
if music.IsPlaying == false then
music:Play()
end
end)
Thanks!

1 comment
"which makes me think that the script isn't even running at all" Have you tried adding a print at the top of your script to see if it runs or not?