Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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
Ad

Answer this question