For loop checking problem!

For some reason if I print v.Name it will print row used while I checked if v is a plate but the row used child still goes true “in the scipt part you can see where I printed I marked it!”, please help me!

This is the script!

local platesFolder = game.Workspace:WaitForChild("PlatesFolder")

for i, val in pairs(workspace.PlatesFolder:GetChildren()) do
	for i, v in pairs(val:GetChildren()) do
		if v.Name == "Plate" then
			v.Touched:Connect(function(otherPart)
				if otherPart.Parent:FindFirstChild("Humanoid") then
					if v.Parent.RowUsed.Value == false then
						v.Parent.RowUsed.Value = true

						local newRow = v.Parent.Row.Value + 1

						local row = platesFolder:FindFirstChild("Row"..tostring(newRow))

						local randomNumber = math.random(1,3)

						if randomNumber == 1 then
							local line = v.Line.Value
							local lineToMakeSave = line - 1
							if lineToMakeSave < 1 then
								for i,v in pairs(row:GetChildren()) do
									if v.Line.Value == line then
										v.Kill.Value = false
									end
								end
							else
								for i,v in pairs(row:GetChildren()) do
									if v.Line.Value == lineToMakeSave then
										v.Kill.Value = false
									end
								end
							end

						elseif randomNumber == 2 then
							local line = v.Line.Value
							for i,v in pairs(row:GetChildren()) do
								print(v.Name) ----------------right here is the mark
								if v.Line.Value == line then
									v.Kill.Value = false
								end
							end

						elseif randomNumber == 3 then
							local line = v.Line.Value
							local lineToMakeSave = line + 1
							if lineToMakeSave > 4 then
								for i,v in pairs(row:GetChildren()) do
									if v.Line.Value == line then
										v.Kill.Value = false
									end
								end
							else
								for i,v in pairs(row:GetChildren()) do
									if v.Line.Value == lineToMakeSave then
										v.Kill.Value = false
									end
								end
							end
						end
					end
				end
			end)
		end
	end
end

heres the workspace and error

Is there a line value in each “plate”?, it seems like you’re trying to get value of the row

Local line = v.Row.Line.Value, that might work

You’re referring to the Row model again here.

And here you would have to check if v is a plate again.
As you can see, it’s printing out Plate (x4) followed by RowUsed which is a bool value that doesn’t have a ‘Line’ instance in the tree hierarchy.

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