Function not running

I have an entire system, but I’ll keep it short. Basically I have a server-script that loads in data (in table form) and sends it to the client-side. A function on the client-side will get this, then will take the values from the table and make TextLabels display them.

Everything runs smoothly until the player dies, then the function on the client-side just Ctrls-Alt-4s its self. I put in many prints and I found that it is receiving the data and it says it displaying it, but for some reason it does NOT display it. This is the function and what it does:

local saved = { -- Table that the function is accessing and yes it is updated
	["tasks"] = {["Task1"] = 0, ["Task2"] = 0, ["Task3"] = 0, ["Task4"] = 0, ["Task5"] = 0, ["Task6"] = 0, ["Task7"] = 0, ["Task8"] = 0, ["Task9"] = 0, ["Task10"] = 0},

---Function---

-- taf is a frame

function guiUPDATE(val, addval)
	
	wait(1) -- I thought the game wasn't loaded all the way and was affecting it in some way

	for valname, valcount in pairs(saved.tasks) do
	   taf.MainFrame.ScrollingFrame[valname].TaskPrecentage.Text = valcount .. "%" -- Part that changes the text
	end
end

}

I have spent the last 3 hours or so trying to see what I did wrong and I got nothing, so any help is appreciated.

-Thanks

Have you tried calling the function?

guiUPDATE(val, addval)

Yes, I know for a fact that it is getting called because I put prints that were going off.

Can you add a check for valcount to see if it’s nil or a number?/

Can you show what is happening to the data table? There’s not a lot to speculate with just the table and iteration function.

Before death:

Gui is displaying

  18:46:56.618  Task1 0  -  Client - MainLocalScript:97
  18:46:56.619  Task4 0  -  Client - MainLocalScript:97
  18:46:56.619  Task9 0  -  Client - MainLocalScript:97
  18:46:56.619  Task10 0  -  Client - MainLocalScript:97
  18:46:56.619  Task5 100  -  Client - MainLocalScript:97
  18:46:56.619  Task3 0  -  Client - MainLocalScript:97
  18:46:56.619  Task2 0  -  Client - MainLocalScript:97
  18:46:56.619  Task7 0  -  Client - MainLocalScript:97
  18:46:56.619  Task8 0  -  Client - MainLocalScript:97
  18:46:56.619  Task6 0  -  Client - MainLocalScript:97

After death:

Gui is not displaying

  18:46:56.618  Task1 0  -  Client - MainLocalScript:97
  18:46:56.619  Task4 0  -  Client - MainLocalScript:97
  18:46:56.619  Task9 0  -  Client - MainLocalScript:97
  18:46:56.619  Task10 0  -  Client - MainLocalScript:97
  18:46:56.619  Task5 100  -  Client - MainLocalScript:97
  18:46:56.619  Task3 0  -  Client - MainLocalScript:97
  18:46:56.619  Task2 0  -  Client - MainLocalScript:97
  18:46:56.619  Task7 0  -  Client - MainLocalScript:97
  18:46:56.619  Task8 0  -  Client - MainLocalScript:97
  18:46:56.619  Task6 0  -  Client - MainLocalScript:97

This what I am talking about. The script is running and it prints the correct values, but it does not display anything…

That’s because the player’s PlayerGui folder is emptied on their character dying (being removed).

image

Disable this property if you want the Gui to persist after dying.

That works I guess, but I still want to know why it does not work after I respawn…