Unable to Assign Value Name. String expected, got Nil

Heyo, so I know the error is self explanatory, but… it’s not. I’m running into this issue after sending data via MessagingService. I have printed the data out literally right before assigning it, so I know the value isn’t nil. I know it’s a string and I know that it has data in it. Any ideas as to what could be causing this?

Here’s my code:

local function updateCrews(data)
	local folder = ReplicatedStorage:WaitForChild("Crews")

	for _, crew in data.crews do
		if #folder:GetChildren() < 1 then
            -- printed the data here
			print(crew.name)
			crewFolder = Instance.new("Folder")

            -- assigned the data here, this is the problem child
			crewFolder.Name = crew.name
			
			for _, member in crew.members do
				-- Add Local Player to Crew
				playerId = Instance.new("IntValue")
				playerId.Name = member.playerName
				playerId.Value = member.userId
				playerId.Parent = crewFolder
			end


			crewFolder.Parent = folder
		end

You printed crew.name but not member.playerName. Could that be nil?

1 Like

Edit: I stand corrected. Someway, somehow, member.playerName is the nil value. That makes sense considering the other option didn’t make sense, lol.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.