TimeValue = Instance.new("NumberValue") while true do local PlayerGui = game.Players.LocalPlayer.PlayerGui local TextLabel = PlayerGui.ScreenGui.TextLabel if game:GetService("Lighting").ClockTime >= 14 then TimeValue = 6 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 15 then TimeValue = 7 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 16 then TimeValue = 8 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 16.5 then TimeValue = 9 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 16.8 then TimeValue = 10 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 16.8 then TimeValue = 10 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 17 then TimeValue = 11 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "AM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 17.5 then TimeValue = 12 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "PM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 17.8 then TimeValue = 1 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "PM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 18 then TimeValue = 2 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "PM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 18.5 then TimeValue = 3 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "PM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 18.7 then TimeValue = 4 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "PM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 18.9 then TimeValue = 5 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "PM" .. "[Day Shift]" end if game:GetService("Lighting").ClockTime >= 19 then TimeValue = 6 TextLabel.Text = "Time:".. TimeValue.Value..":00".. "PM" .. "[Day Shift]" end end
20:47:13.183 - Players.jkiop23.PlayerGui.ScreenGui.TextLabel.LocalScript:11: attempt to index global 'TimeValue' (a number value)
this was the error
Your script is to long and because you have cut off some code your "Line 11" is actually line 6.
Heres a shorter and speedier bit of code that does the same:
local PlayerGui = game.Players.LocalPlayer.PlayerGui local TextLable = PlayerGui.ScreenGui.TextLabel local Time = game:GetService("Lighting").ClockTime if Time < 13 then TextLabel.Text = "Time:".. Time ..":00".. "AM" .. "[Day Shift]" else TextLabel.Text = "Time:".. Time - 12 ..":00".. "PM" .. "[Day Shift]" end