For whatever reason probably syntax, I can’t get the time to print into the text label or into the console output so if anyone knows how to do this I would be greatly appreciative.
In LuaU, there is no need to define types and when defining strings, there is no need to put them in brackets, so I will change this line: local TickTime = "Time in ticks". To my knowledge, there is no function called time, so I will use os.time, so I have changed this line: local TimeNumber = os.time().
There is no need to surround variables in brackets unless you are calling a function, so I have changed this line aswell: Clock.Text = TimeNumber.
The final result is this:
wait(5)
local Clock = game.Players.CrazyGrapefruit32.PlayerGui.ScreenGui.TickDisplay
local TimeNumber = os.time()
local TickTime = "Time in ticks"
while true do
wait(0.5)
Clock.Text = TimeNumber
print(TimeNumber)
print(TickTime)
end
Please be aware that os.time prints the number of seconds since the Unix Epoch.
here is a quick script i have made that could fix this.
--local script
repeat task.wait() until game.Players.LocalPlayer.PlayerGui:FindFirstChild("TickDisplay", true)
local timenumber = 0
local Clock = game.Players.LocalPlayer.PlayerGui:FindFirstChild("TickDisplay", true)
while task.wait(1) do
timenumber += 1
Clock.Text = timenumber
print( timenumber )
print( tick() ) --assuming what you meant by "Time in ticks" is this
end
local clocktimer = 0
task.spawn(function()
while task.wait() do
clocktimer = math.floor(time())
--this will return the amount of seconds that has elapsed since the server started in seconds.
end
end)
wait(3)
local player = game:GetService("Players").LocalPlayer
--local Clock = player:WaitForChild("PlayerGui"):WaitForChild("TickDisplay")
-- :WaitForChild("Frame"):WaitForChild("TextLabel")
local rns=game:GetService("RunService")
local Clock=script.Parent -- local clientScript inside the textlable
local startTime = tick()
while true do
local elapsedTime = tick() - startTime
local ticks = elapsedTime * 60 -- Assuming 1 tick = 1/60th of a second
Clock.Text = "Ticks: " .. math.floor(ticks)
rns.Stepped:Wait() Clock.Text = ""
print("Elapsed Time:", elapsedTime)
print("Ticks:", math.floor(ticks))
end