TextLabel Bug [Fixed]

Hello, I’m scripter, and today I got this:


Any ideas how to fix it?
It wrote in properties, but it didn’t wrote here.

spawn(function()
	local plr = game.Players.LocalPlayer
	repeat wait() until plr:FindFirstChild("PlayerStatus")
	while true do
		local args = string.split(plr.PlayerStatus.TimePlaying.Value,":")
		if args[1] ~= 1 and args[2] ~= 1 then
			script.Parent.Text = args[1] .. " hours " .. args[2] .. " minutes"
		elseif args[1] == 1 and args[2] ~= 1 then
			script.Parent.Text = "1 hour " .. args[2] .. " minutes"	
		elseif args[1] ~= 1 and args[2] == 1 then
			script.Parent.Text =  args[1] .. " hour 1 minute"	
		elseif args[1] == 1 and args[2] == 1 then
			script.Parent.Text =  "1 hour 1 minute"		
		end
		wait(0.1)
	end
end)

1 Like

Any errors in output? If not i suggest doing some debugging to see where it breaks

1 Like

No errors, I see text in “Properties”. But why it didn’t wrote where “Time played:” ?

Try reloading studio, maybe its just a visual bug…

Still… I don’t know what happened.

Does this also happen when you are in game?

Yes, its is… and script works well… I don’t know how this is happened. Oh wait something has changed.

Alright I changed script, it now works well. :confused:

spawn(function()
	local plr = game.Players.LocalPlayer
	repeat wait() until plr:FindFirstChild("PlayerStatus")
	while true do
		local args = string.split(plr.PlayerStatus.TimePlaying.Value,":")
		script.Parent.Text = args[1] .. "h " .. args[2] .. "min"
	end	
end)

[/quote]

2 Likes

Oh wait. I did a mistake on script, I finally noticed that.
args[1] and args[2] are strings, not a numbers.
Sorry guys.

spawn(function()
	local plr = game.Players.LocalPlayer
	repeat wait() until plr:FindFirstChild("PlayerStatus")
	while true do
		local args = string.split(plr.PlayerStatus.TimePlaying.Value,":")
		if args[1] ~= "1" and args[2] ~= "1" then
			script.Parent.Text = args[1] .. " hours " .. args[2] .. " minutes"
		elseif args[1] == "1" and args[2] ~= "1" then
			script.Parent.Text = "1 hour " .. args[2] .. " minutes"	
		elseif args[1] ~= "1" and args[2] == "1" then
			script.Parent.Text =  args[1] .. " hour 1 minute"	
		elseif args[1] == "1" and args[2] == "1" then
			script.Parent.Text =  "1 hour 1 minute"		
		end
		wait(0.1)
	end
end)