Attempt to concatenate string with nil, need urgent help

For the past hour, i’ve been trying to figure out my issue here:

- ServerScriptService.MainGame:129: attempt to concatenate string with nil

		for _,v in pairs(workspace.Map:GetChildren()) do
			for _,x in pairs(v:GetChildren()) do
				if x.Name == "Prisoner" then
					--if v.Prisoner.Value ~= nil then
					x.Value = nil
					print('Set Prisoner in '.. v.Name .." to nil".. x.Value) -- line 129
					--end
				end
			end
		end

image

image

image

Firstly, it would set only the first prisoner to nil as well without printing anything before the error as it should’ve as well, the 2 pictures above show an example…

1 Like

I’m confused. You set x.Value to nil. Then you attempt to concentate x.Value, which is nil.

1 Like

Try putting x.Value = nil after the print.

You cannot concentate nothing with a string…

1 Like

I was sure you could print nil values for some reason…

Moving the print a line downwards gives me a new error:
attempt to concatenate string with Instance

:upside_down_face:

I realize since it’s an object value I may need to print x.Value.Name…

Yeah…

That is because you are using a ObjectValue, I guess you would want to see the name of the object before putting it to nil, so you’d say x.Value.Name.

1 Like

These small things I break my sweat on, and also simple… Atleast this is why the dev forum community exists :slight_smile:

Yes indeed! It is a very great place for help!

1 Like