Argument 1 missing or nil

Trying to create a function which adds an objectvalue into a folder IF that folder is empty, but if it is not empty it finds the value and changes the name but im getting the following error:
image

This is the script:

(levelclaimed is set from a local script which works fine)

You’re trying to compare a table to 0, instead prepend that :GetChildren() call with “#” to convert it to an integer number representing how many values are in the table it’s returning.

1 Like
local item = game.ServerStorage.PlayerData[player.Name].SeasonrewardInventory:FindFirstChildOfClass("ObjectValue")

Try this instead.

1 Like