Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

My script won't add one to an IntValue, how can I fix it?

I am trying to make a day/night script but also utilize values to change the day from Sunday, to Monday, and so on, but for some reason, the value won't change and I'm not receiving any errors.

local lighting = game:GetService("Lighting")
local replicatedStorage = game:GetService("ReplicatedStorage")
local event = replicatedStorage:findFirstChild("Time")

while wait(.9) do
 local hours = math.floor(lighting:GetMinutesAfterMidnight() / 60)
 local suffix = "AM"
 local minutes = lighting:GetMinutesAfterMidnight() - (hours * 60)
 if hours > 11 then
  hours = hours - 12
  suffix = "PM"
 end
 
 if hours == 0 then
  hours = 12
 end
 
 if minutes < 10 then
  minutes = "0" .. minutes
 end

 local text = hours .. ":" .. minutes .. " " .. suffix
 event:FireAllClients(text)
 lighting:SetMinutesAfterMidnight(lighting:GetMinutesAfterMidnight() + 1)
end

if game.Lighting.ClockTime == 0.00 or 00 or 0 then
	local value = game.Lighting.DotW
	for i = 1,1 do
	value.Value = value.Value + 1
	end
end

1 answer

At line 29 the Start value and End value are the same (which is the reason it wouldn't work) make the End Value Higher (maybe 2 or 10 idk)

for i = 1,10 do -- End value should be higher than Start
wait(.1) don't forget to include a wait

This discussion is preserved as it was. New answers, comments, and votes are closed.