Half script working, not full. Help needed!

My local script for weather indication works half, but not full. Help is needed! Should I use heartbeat?

For example:

If I set the lighting to like 12, the weather indication will still remain on morning? Why?

local Lighting = game:GetService("Lighting")

while true do

if workspace:FindFirstChild("Rain") then
	          script.Parent.Text = "Rainy"
	          script.Parent.Parent.Emoji.Text = "ā›ˆ"
elseif workspace:FindFirstChild("Rain")  ~= nil and Lighting.ClockTime >= 19 then
	          script.Parent.Text = "Rainy Night"
	          script.Parent.Parent.Emoji.Text = "ā˜ļø šŸŒ™"
elseif workspace:FindFirstChild("Rain")  == nil and Lighting.ClockTime >= 19 then
	          script.Parent.Text = "Night"
	          script.Parent.Parent.Emoji.Text = "šŸŒ™"
elseif  Lighting.ClockTime >= 7 then
	          script.Parent.Text = "Morning"
	          script.Parent.Parent.Emoji.Text = "šŸŒ…"
elseif Lighting.ClockTime >= 12 then
	          script.Parent.Text = "Afternoon"
	          script.Parent.Parent.Emoji.Text = "ā˜€ļø"
elseif Lighting.ClockTime >= 16 then
	          script.Parent.Text = "Evening"
	          script.Parent.Parent.Emoji.Text = "šŸŒ‡ "
       end
wait(1)
end

Where is the LocalScript placed?

Inside the text label, it is placed.

There is nothing wrong with the script, the only problem here could be the if statement, and the conditions

1 Like

Got that thinking here, I’m using else if statements though.

What has happened is that the script has stop running after the morning elseif statement.

Because the conditions were already satisfied (12 >= 7) it will not continue to the afternoon statement and return Morning.

Rearrange the statements in decreasing order so it does not grab the wrong one.

2 Likes

Ok, thank you! ( 30 characters)