So I have this Day/Night cycle code I made, and I was wondering what I could add to this to make it change text in a TextLabel.
Here is my code:
local interval = 0.4 local change = 0.01 while wait(interval) do game.Lighting.ClockTime = game.Lighting.ClockTime + change end
Any help is appreciated!
-- Client Script local Players = game:GetService("Players") -- Player Service local Lighting = game:GetService("Lighting") -- Lighting Service local LocalPlayer = Players.LocalPlayer -- Our Client local PlayerGui = LocalPlayer.PlayerGui -- Our Gui path, StarterGui clones it to here for each player. local Gui = PlayerGui.ScreenGui -- Our Gui local TextLabel = Gui.TextLabel -- Our Textlabel to change. local Interval, Change = .5, .01 -- Declaring our Variables while wait(Interval) do -- while loop. Lighting.ClockTime = Lighting.ClockTime + Change -- Setting new time TextLabel.Text = ("%s"):format(Lighting.TimeOfDay) -- Set textlabel to time. end
:) Hope this has helped in any shape.
This is Simple Just create a script inside the TextLabel and copy the code below into it.
game:GetService("RunService").Stepped:Connect(function() --A loop script.Parent.Text = "Time: "..game.Lighting.ClockTime --Changes Text of TextLabel to Clock Time end)